| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #ifndef GUI_VIEWPROVIDER_MEASUREMENTBASE_H
|
| | #define GUI_VIEWPROVIDER_MEASUREMENTBASE_H
|
| |
|
| | #include <Mod/Measure/MeasureGlobal.h>
|
| |
|
| | #include <QString>
|
| |
|
| | #include <App/Application.h>
|
| | #include <App/PropertyStandard.h>
|
| | #include <Base/Parameter.h>
|
| | #include <Gui/ViewProviderDocumentObject.h>
|
| | #include <Gui/SoTextLabel.h>
|
| | #include <Gui/ViewProviderDocumentObjectGroup.h>
|
| |
|
| | #include <Mod/Measure/App/MeasureBase.h>
|
| |
|
| |
|
| | class SbVec2s;
|
| | class SoFontStyle;
|
| | class SoBaseColor;
|
| | class SoText2;
|
| | class SoTranslation;
|
| | class SoPickStyle;
|
| | class SoCoordinate3;
|
| | class SoIndexedLineSet;
|
| | class SoTranslate2Dragger;
|
| |
|
| |
|
| |
|
| | namespace MeasureGui
|
| | {
|
| |
|
| |
|
| | class MeasureGuiExport ViewProviderMeasureGroup: public Gui::ViewProviderDocumentObjectGroup
|
| | {
|
| | PROPERTY_HEADER_WITH_OVERRIDE(MeasureGui::ViewProviderMeasureGroup);
|
| |
|
| | public:
|
| | ViewProviderMeasureGroup();
|
| | ~ViewProviderMeasureGroup() override;
|
| |
|
| | bool allowOverride(const App::DocumentObject&) const override
|
| | {
|
| | return true;
|
| | }
|
| |
|
| | QIcon getIcon() const override;
|
| | };
|
| |
|
| |
|
| |
|
| | class MeasureGuiExport ViewProviderMeasureBase: public Gui::ViewProviderDocumentObject
|
| | {
|
| | PROPERTY_HEADER_WITH_OVERRIDE(MeasureGui::ViewProviderMeasureBase);
|
| |
|
| | public:
|
| |
|
| | ViewProviderMeasureBase();
|
| |
|
| |
|
| | ~ViewProviderMeasureBase() override;
|
| |
|
| |
|
| | App::PropertyColor TextColor;
|
| | App::PropertyColor TextBackgroundColor;
|
| | App::PropertyColor LineColor;
|
| | App::PropertyInteger FontSize;
|
| |
|
| |
|
| |
|
| | SoSFFloat fieldFontSize;
|
| |
|
| | |
| | |
| |
|
| | bool isPartOfPhysicalObject() const override
|
| | {
|
| | return false;
|
| | };
|
| | void attach(App::DocumentObject* pcObj) override;
|
| | void updateData(const App::Property* prop) override;
|
| | virtual void positionAnno(const Measure::MeasureBase* measureObject);
|
| | void finishRestoring() override;
|
| |
|
| | bool useNewSelectionModel() const override
|
| | {
|
| | return true;
|
| | }
|
| | std::vector<std::string> getDisplayModes() const override;
|
| | void setDisplayMode(const char* ModeName) override;
|
| |
|
| | void show() override;
|
| |
|
| | virtual void redrawAnnotation();
|
| | Measure::MeasureBase* getMeasureObject();
|
| |
|
| | virtual bool isSubjectVisible();
|
| |
|
| | static Base::Vector3d toVector3d(SbVec3f svec)
|
| | {
|
| | return Base::Vector3d(svec[0], svec[1], svec[2]);
|
| | }
|
| | static SbVec3f toSbVec3f(Base::Vector3d vec3)
|
| | {
|
| | return SbVec3f(vec3.x, vec3.y, vec3.z);
|
| | }
|
| |
|
| | void onSubjectVisibilityChanged(const App::DocumentObject& docObj, const App::Property& prop);
|
| | void connectToSubject(App::DocumentObject* subject);
|
| | void connectToSubject(std::vector<App::DocumentObject*> subject);
|
| |
|
| | protected:
|
| | static void draggerChangedCallback(void* data, SoDragger*);
|
| | void onChanged(const App::Property* prop) override;
|
| | virtual void onLabelMoved() {};
|
| | void setLabelValue(const Base::Quantity& value);
|
| | void setLabelValue(const QString& value);
|
| | void setLabelTranslation(const SbVec3f& position);
|
| | void updateIcon();
|
| |
|
| | SoPickStyle* getSoPickStyle();
|
| | SoDrawStyle* getSoLineStylePrimary();
|
| | SoDrawStyle* getSoLineStyleSecondary();
|
| | SoSeparator* getSoSeparatorText();
|
| |
|
| | static constexpr double defaultTolerance = 10e-6;
|
| | virtual Base::Vector3d getTextDirection(
|
| | Base::Vector3d elementDirection,
|
| | double tolerance = defaultTolerance
|
| | );
|
| | float getViewScale();
|
| |
|
| |
|
| | bool _mShowTree = true;
|
| |
|
| | SoSeparator* pGlobalSeparator;
|
| | Gui::SoFrameLabel* pLabel;
|
| | SoTranslate2Dragger* pDragger;
|
| | SoTransform* pDraggerOrientation;
|
| | SoTransform* pLabelTranslation;
|
| | SoBaseColor* pColor;
|
| | SoSeparator* pRootSeparator;
|
| | SoSeparator* pTextSeparator;
|
| | SoSeparator* pLineSeparator;
|
| | SoSeparator* pLineSeparatorSecondary;
|
| |
|
| | private:
|
| | fastsignals::connection _mVisibilityChangedConnection;
|
| | };
|
| |
|
| |
|
| |
|
| | class MeasureGuiExport ViewProviderMeasure: public MeasureGui::ViewProviderMeasureBase
|
| | {
|
| | PROPERTY_HEADER_WITH_OVERRIDE(MeasureGui::ViewProviderMeasure);
|
| |
|
| |
|
| | public:
|
| |
|
| | ViewProviderMeasure();
|
| | ~ViewProviderMeasure() override;
|
| |
|
| | void redrawAnnotation() override;
|
| | void positionAnno(const Measure::MeasureBase* measureObject) override;
|
| |
|
| | protected:
|
| | void onChanged(const App::Property* prop) override;
|
| |
|
| | virtual Base::Vector3d getBasePosition();
|
| | virtual Base::Vector3d getTextPosition();
|
| |
|
| | private:
|
| | SoCoordinate3* pCoords;
|
| | SoIndexedLineSet* pLines;
|
| | };
|
| |
|
| |
|
| | class ViewProviderMeasureArea: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasureArea);
|
| |
|
| | public:
|
| | ViewProviderMeasureArea()
|
| | {
|
| | sPixmap = "Measurement-Area";
|
| | }
|
| | };
|
| |
|
| |
|
| | class ViewProviderMeasureLength: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasureLength);
|
| |
|
| | public:
|
| | ViewProviderMeasureLength()
|
| | {
|
| | sPixmap = "Measurement-Distance";
|
| | }
|
| | };
|
| |
|
| |
|
| | class ViewProviderMeasurePosition: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasurePosition);
|
| |
|
| | public:
|
| | ViewProviderMeasurePosition()
|
| | {
|
| | sPixmap = "Measurement-Position";
|
| | }
|
| | };
|
| |
|
| |
|
| | class ViewProviderMeasureRadius: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasureRadius);
|
| |
|
| | public:
|
| | ViewProviderMeasureRadius()
|
| | {
|
| | sPixmap = "Measurement-Radius";
|
| | }
|
| | };
|
| |
|
| | class ViewProviderMeasureDiameter: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasureDiameter);
|
| |
|
| | public:
|
| | ViewProviderMeasureDiameter()
|
| | {
|
| | sPixmap = "Measurement-Diameter";
|
| | }
|
| | };
|
| |
|
| | class ViewProviderMeasureCOM: public ViewProviderMeasure
|
| | {
|
| | PROPERTY_HEADER(MeasureGui::ViewProviderMeasureCOM);
|
| |
|
| | public:
|
| | ViewProviderMeasureCOM()
|
| | {
|
| | sPixmap = "Measurement-CenterOfMass";
|
| | }
|
| | };
|
| |
|
| |
|
| | }
|
| |
|
| | #endif
|
| |
|