VPart/VSection Graphic Properties to Gui side

This commit is contained in:
WandererFan
2018-02-14 09:06:36 -05:00
parent cbca02f7f3
commit 02b64dca3a
11 changed files with 141 additions and 96 deletions

View File

@@ -57,6 +57,7 @@
#include "DrawViewPartPy.h"
#include "GeometryObject.h"
#include "EdgeWalker.h"
#include "DrawUtil.h"
namespace TechDraw {
@@ -380,7 +381,8 @@ private:
TechDrawGeometry::GeometryObject* go = dvp->getGeometryObject();
//visible group begin "<g ... >"
ss << grpHead1;
double thick = dvp->LineWidth.getValue();
// double thick = dvp->LineWidth.getValue();
double thick = DrawUtil::getDefaultLineWeight("Thick");
ss << thick;
ss << grpHead2;
TopoDS_Shape s = go->getVisHard();
@@ -403,7 +405,8 @@ private:
dvp->SeamHidden.getValue() ) {
//hidden group begin
ss << grpHead1;
thick = dvp->HiddenWidth.getValue();
// thick = dvp->HiddenWidth.getValue();
thick = DrawUtil::getDefaultLineWeight("Thin");
ss << thick;
ss << grpHead2;
if (dvp->HardHidden.getValue()) {

View File

@@ -425,6 +425,17 @@ double DrawUtil::sensibleScale(double working_scale)
return result;
}
double DrawUtil::getDefaultLineWeight(std::string lineType)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
auto lg = LineGroup::lineGroupFactory(lgName);
double weight = lg->getWeight(lineType);
return weight;
}
//============================
// various debugging routines.
void DrawUtil::dumpVertexes(const char* text, const TopoDS_Shape& s)

View File

@@ -40,6 +40,8 @@
#include <Base/Vector3D.h>
#include <Base/Matrix.h>
#include "LineGroup.h"
#define VERTEXTOLERANCE (2.0 * Precision::Confusion())
namespace TechDraw
@@ -72,6 +74,7 @@ class TechDrawExport DrawUtil {
Base::Vector3d axis,
Base::Vector3d org = Base::Vector3d(0.0,0.0,0.0));
static Base::Vector3d closestBasis(Base::Vector3d v);
static double getDefaultLineWeight(std::string s);

View File

@@ -71,8 +71,7 @@ DrawView::DrawView(void)
: autoPos(true),
mouseMove(false)
{
static const char *group = "BaseView";
static const char *fgroup = "Format";
static const char *group = "Base";
ADD_PROPERTY_TYPE(X ,(0),group,App::Prop_None,"X position of the view on the page in modelling units (mm)");
ADD_PROPERTY_TYPE(Y ,(0),group,App::Prop_None,"Y position of the view on the page in modelling units (mm)");
@@ -84,7 +83,7 @@ DrawView::DrawView(void)
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
Scale.setConstraints(&scaleRange);
ADD_PROPERTY_TYPE(Caption ,(""),fgroup,App::Prop_None,"Short text about the view");
ADD_PROPERTY_TYPE(Caption ,(""),group,App::Prop_None,"Short text about the view");
}
DrawView::~DrawView()

View File

@@ -118,14 +118,12 @@ PROPERTY_SOURCE(TechDraw::DrawViewPart, TechDraw::DrawView)
DrawViewPart::DrawViewPart(void) : geometryObject(0)
{
static const char *group = "Projection";
static const char *fgroup = "Format";
static const char *lgroup = "Lines";
static const char *sgroup = "Show";
static const char *sgroup = "HLR Parameters";
nowUnsetting = false;
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
double defDist = hGrp->GetFloat("FocusDistance",100.0);
bool coarseView = hGrp->GetBool("CoarseView", false);
//properties that affect Geometry
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"3D Shape to view");
@@ -134,7 +132,8 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
ADD_PROPERTY_TYPE(Perspective ,(false),group,App::Prop_None,"Perspective(true) or Orthographic(false) projection");
ADD_PROPERTY_TYPE(Focus,(defDist),group,App::Prop_None,"Perspective view focus distance");
//properties that affect Appearance
//properties that control HLR algoaffect Appearance
bool coarseView = hGrp->GetBool("CoarseView", false);
ADD_PROPERTY_TYPE(CoarseView, (coarseView), sgroup, App::Prop_None, "Coarse View on/off");
//visible outline
ADD_PROPERTY_TYPE(SmoothVisible ,(false),sgroup,App::Prop_None,"Visible Smooth lines on/off");
@@ -145,33 +144,9 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
ADD_PROPERTY_TYPE(SeamHidden ,(false),sgroup,App::Prop_None,"Hidden Seam lines on/off");
ADD_PROPERTY_TYPE(IsoHidden ,(false),sgroup,App::Prop_None,"Hidden Iso u,v lines on/off");
ADD_PROPERTY_TYPE(IsoCount ,(0),sgroup,App::Prop_None,"Number of isoparameters");
//default line weights
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
auto lg = LineGroup::lineGroupFactory(lgName);
double weight = lg->getWeight("Thick");
ADD_PROPERTY_TYPE(LineWidth,(weight),lgroup,App::Prop_None,"The thickness of visible lines");
weight = lg->getWeight("Thin");
ADD_PROPERTY_TYPE(HiddenWidth,(weight),lgroup,App::Prop_None,"The thickness of hidden lines, if enabled");
weight = lg->getWeight("Graphic");
ADD_PROPERTY_TYPE(IsoWidth,(weight),lgroup,App::Prop_None,"The thickness of isoparameter/center/section lines, if enabled");
weight = lg->getWeight("Extra");
ADD_PROPERTY_TYPE(ExtraWidth,(weight),lgroup,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled");
ADD_PROPERTY_TYPE(HorizCenterLine ,(false),lgroup,App::Prop_None,"Show a horizontal centerline through view");
ADD_PROPERTY_TYPE(VertCenterLine ,(false),lgroup,App::Prop_None,"Show a vertical centerline through view");
ADD_PROPERTY_TYPE(ArcCenterMarks ,(true),sgroup,App::Prop_None,"Center marks on/off");
ADD_PROPERTY_TYPE(CenterScale,(2.0),fgroup,App::Prop_None,"Center mark size adjustment, if enabled");
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup,App::Prop_None,"Show/hide section line if applicable");
geometryObject = nullptr;
getRunControl();
delete lg;
}
DrawViewPart::~DrawViewPart()
@@ -306,7 +281,18 @@ short DrawViewPart::mustExecute() const
result = (Direction.isTouched() ||
Source.isTouched() ||
Scale.isTouched() ||
ScaleType.isTouched());
ScaleType.isTouched() ||
Perspective.isTouched() ||
Focus.isTouched() ||
SmoothVisible.isTouched() ||
SeamVisible.isTouched() ||
IsoVisible.isTouched() ||
HardHidden.isTouched() ||
SmoothHidden.isTouched() ||
SeamHidden.isTouched() ||
IsoHidden.isTouched() ||
IsoCount.isTouched() ||
CoarseView.isTouched());
}
if (result) {

View File

@@ -100,17 +100,6 @@ public:
App::PropertyBool IsoHidden;
App::PropertyInteger IsoCount;
App::PropertyFloat LineWidth;
App::PropertyFloat HiddenWidth;
App::PropertyFloat IsoWidth;
App::PropertyFloat ExtraWidth;
App::PropertyBool ArcCenterMarks;
App::PropertyFloat CenterScale;
App::PropertyBool HorizCenterLine;
App::PropertyBool VertCenterLine;
App::PropertyBool ShowSectionLine;
std::vector<TechDraw::DrawHatch*> getHatches(void) const;
std::vector<TechDraw::DrawGeomHatch*> getGeomHatches(void) const;
std::vector<TechDraw::DrawViewDimension*> getDimensions() const;

View File

@@ -104,8 +104,7 @@ PROPERTY_SOURCE(TechDraw::DrawViewSection, TechDraw::DrawViewPart)
DrawViewSection::DrawViewSection()
{
static const char *sgroup = "Section";
static const char *fgroup = "Format";
//static const char *lgroup = "Line";
static const char *fgroup = "Cut Surface Format";
ADD_PROPERTY_TYPE(SectionSymbol ,("A"),sgroup,App::Prop_None,"The identifier for this section");
@@ -119,14 +118,6 @@ DrawViewSection::DrawViewSection()
ADD_PROPERTY_TYPE(NameGeomPattern ,(""),fgroup,App::Prop_None,"The pattern name for geometric hatching");
ADD_PROPERTY_TYPE(HatchScale,(1.0),fgroup,App::Prop_None,"Hatch pattern size adjustment");
// ADD_PROPERTY_TYPE(ShowCutSurface ,(true),fgroup,App::Prop_None,"Show/hide the cut surface");
// ADD_PROPERTY_TYPE(CutSurfaceColor,(0.0,0.0,0.0),fgroup,App::Prop_None,"The color to shade the cut surface");
// ADD_PROPERTY_TYPE(HatchCutSurface ,(false),fgroup,App::Prop_None,"Hatch the cut surface");
// ADD_PROPERTY_TYPE(FileHatchPattern ,(""),fgroup,App::Prop_None,"The hatch pattern file for the cut surface");
// ADD_PROPERTY_TYPE(NameGeomPattern ,(""),fgroup,App::Prop_None,"The pattern name for geometric hatching");
// ADD_PROPERTY_TYPE(HatchColor,(0.0,0.0,0.0),fgroup,App::Prop_None,"The color of the hatch pattern");
getParameters();
}