Add MeasureFactory
This commit is contained in:
35
src/src/measure/MeasureFactory.cpp
Normal file
35
src/src/measure/MeasureFactory.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/10.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MeasureFactory.h"
|
||||||
|
#include "RulerAnnotationActor.h"
|
||||||
|
#include "AngleAnnotationActor.h"
|
||||||
|
#include "OpenPolyAnnotationActor.h"
|
||||||
|
#include "TextAnnotationActor.h"
|
||||||
|
#include "ArrowAnnotationActor.h"
|
||||||
|
#include "EllipseAnnotationActor.h"
|
||||||
|
|
||||||
|
Measure *MeasureFactory::getMeasure(AnnotationActorType type) {
|
||||||
|
switch (type) {
|
||||||
|
case AnnotationActorType::AngleAnn:
|
||||||
|
return AngleAnnotationActor::New();
|
||||||
|
case AnnotationActorType::RulerAnn:
|
||||||
|
return RulerAnnotationActor::New();
|
||||||
|
case AnnotationActorType::ClosedPolygonAnn:{
|
||||||
|
OpenPolyAnnotationActor* ann = OpenPolyAnnotationActor::New();
|
||||||
|
ann->SetClosed(1);
|
||||||
|
return ann;
|
||||||
|
}
|
||||||
|
case AnnotationActorType::OpenPolygonAnn:
|
||||||
|
return OpenPolyAnnotationActor::New();
|
||||||
|
case AnnotationActorType::ArrowAnn:
|
||||||
|
return ArrowAnnotationActor::New();
|
||||||
|
case AnnotationActorType::EllipseAnn:
|
||||||
|
return EllipseAnnotationActor::New();
|
||||||
|
case AnnotationActorType::TextAnn:
|
||||||
|
return TextAnnotationActor::New();
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/src/measure/MeasureFactory.h
Normal file
14
src/src/measure/MeasureFactory.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/10.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OMEGAV_MEASUREFACTORY_H
|
||||||
|
#define OMEGAV_MEASUREFACTORY_H
|
||||||
|
#include "Measure.h"
|
||||||
|
#include "QGlobals.h"
|
||||||
|
class MeasureFactory {
|
||||||
|
static Measure* getMeasure(AnnotationActorType type);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //OMEGAV_MEASUREFACTORY_H
|
||||||
Reference in New Issue
Block a user