Geometric hatch for Section face

This commit is contained in:
WandererFan 2017-01-22 08:41:04 -05:00
parent 1d3a8a910f
commit 299ac94c9f
18 changed files with 427 additions and 236 deletions

View File

@ -64,6 +64,7 @@
#include "DrawUtil.h"
#include "Geometry.h"
#include "DrawViewPart.h"
#include "DrawViewSection.h"
#include "DrawCrosshatch.h"
#include <Mod/TechDraw/App/DrawCrosshatchPy.h> // generated from DrawCrosshatchPy.xml
@ -78,41 +79,13 @@ PROPERTY_SOURCE(TechDraw::DrawCrosshatch, App::DocumentObject)
DrawCrosshatch::DrawCrosshatch(void)
{
static const char *vgroup = "Crosshatch";
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Crosshatch", 0x00000000));
ADD_PROPERTY_TYPE(DirProjection ,(0,0,1.0) ,vgroup,App::Prop_None,"Projection direction when Crosshatch was defined"); //sb RO?
ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be crosshatched");
ADD_PROPERTY_TYPE(FilePattern ,(""),vgroup,App::Prop_None,"The crosshatch pattern file for this area");
ADD_PROPERTY_TYPE(NamePattern,(""),vgroup,App::Prop_None,"The name of the pattern");
ADD_PROPERTY_TYPE(ScalePattern,(1.0),vgroup,App::Prop_None,"Crosshatch pattern size adjustment");
// ADD_PROPERTY_TYPE(ColorPattern,(fcColor),vgroup,App::Prop_None,"The color of the pattern"); //to vp?
// ADD_PROPERTY_TYPE(WeightPattern,(0.0),vgroup,App::Prop_None,"Crosshatch pattern line thickness");
// ADD_PROPERTY_TYPE(LineSpecs,(""),vgroup,App::Prop_None,"Pattern line specifications"); //this sb RO or removed?
DirProjection.setStatus(App::Property::ReadOnly,true);
//this is probably "/build/data/Mod/TechDraw/PAT"
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/PAT/";
std::string defaultFileName = defaultDir + "FCStd.pat";
QString patternFileName = QString::fromStdString(hGrp->GetASCII("FilePattern",defaultFileName.c_str()));
if (patternFileName.isEmpty()) {
patternFileName = QString::fromStdString(defaultFileName);
}
QFileInfo tfi(patternFileName);
if (tfi.isReadable()) {
FilePattern.setValue(patternFileName.toUtf8().constData());
}
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
std::string defaultNamePattern = "Diamond";
NamePattern.setValue(hGrp->GetASCII("NamePattern",defaultNamePattern.c_str()));
getParameters();
}
@ -144,12 +117,6 @@ void DrawCrosshatch::onChanged(const App::Property* prop)
}
}
if (prop == &ScalePattern) {
if (!isRestoring()) {
adviseParent(); //just need to have the parent redraw on Gui side. handle through VPDC::updateData
}
}
App::DocumentObject::onChanged(prop);
}
@ -171,37 +138,10 @@ short DrawCrosshatch::mustExecute() const
App::DocumentObjectExecReturn *DrawCrosshatch::execute(void)
{
DrawViewPart* source = getSourceView();
if (!source) {
return App::DocumentObject::StdReturn;
}
if (!source->hasGeometry()) {
return App::DocumentObject::StdReturn;
}
Base::Vector3d sourceDir = source->Direction.getValue();
Base::Vector3d ourDir = DirProjection.getValue();
if (sourceDir != ourDir) {
Base::Console().Warning("Pattern %s may be incorrect due to source %d Direction change.\n",
getNameInDocument(),source->getNameInDocument());
}
adviseParent();
return App::DocumentObject::StdReturn;
}
void DrawCrosshatch::adviseParent(void) const
{
//if the hatch changes, the source has to change too. actually only the source's QGVI has to change.
DrawViewPart* parent = getSourceView();
if (parent) {
parent->touch();
parent->recomputeFeature();
}
}
DrawViewPart* DrawCrosshatch::getSourceView(void) const
{
App::DocumentObject* obj = Source.getValue();
@ -209,12 +149,19 @@ DrawViewPart* DrawCrosshatch::getSourceView(void) const
return result;
}
//!get all the specification lines and decode them into HatchLine structures
std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile()
{
std::vector<HatchLine> result;
std::string fileSpec = FilePattern.getValue();
std::string myPattern = NamePattern.getValue();
return getDecodedSpecsFromFile(fileSpec,myPattern);
}
//!get all the specification lines and decode them into HatchLine structures
/*static*/
std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern)
{
std::vector<HatchLine> result;
Base::FileInfo fi(fileSpec);
if (!fi.isReadable()) {
Base::Console().Error("DrawCrosshatch::getDecodedSpecsFromFile not able to open %s!\n",fileSpec.c_str());
@ -225,29 +172,46 @@ std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile()
return result;
}
std::vector<LineSet> DrawCrosshatch::getDrawableLines()
std::vector<LineSet> DrawCrosshatch::getDrawableLines(int i) //get the drawable lines for face i
{
std::vector<LineSet> result;
DrawViewPart* source = getSourceView();
if (!source ||
!source->hasGeometry()) {
Base::Console().Message("TRACE - DC::getDrawableLines - no source geometry\n");
return result;
}
return getDrawableLines(source, m_lineSets,i, ScalePattern.getValue());
}
/* static */
std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std::vector<LineSet> lineSets, int iface, double scale )
{
std::vector<LineSet> result;
//is source is a section?
DrawViewSection* section = dynamic_cast<DrawViewSection*>(source);
bool usingSection = false;
if (section != nullptr) {
usingSection = true;
}
if (m_lineSets.empty()) {
Base::Console().Message("TRACE - DC::getDrawableLines - no LineSets!\n");
if (lineSets.empty()) {
Base::Console().Log("INFO - DC::getDrawableLines - no LineSets!\n");
return result;
}
//get geometry for linked Face
const std::vector<std::string> &subElements = Source.getSubValues();
int idx = DrawUtil::getIndexFromName(subElements[0]);
std::vector<TopoDS_Wire> faceWires;
if (usingSection) {
faceWires = section->getWireForFace(iface);
} else {
faceWires = source->getWireForFace(iface);
}
//build wire(s) from geometry
std::vector<TopoDS_Wire> faceWires = source->getWireForFace(idx);
gp_Pln plane = source->getProjPlane();
//build face(s) from geometry
gp_Pnt gOrg(0.0,0.0,0.0);
gp_Dir gDir(0.0,0.0,1.0);
gp_Pln plane(gOrg,gDir);
BRepBuilderAPI_MakeFace mkFace(plane, faceWires.front(), true);
std::vector<TopoDS_Wire>::iterator itWire = ++faceWires.begin(); //starting with second wire
@ -255,7 +219,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines()
mkFace.Add(*itWire);
}
if (!mkFace.IsDone()) {
Base::Console().Message("TRACE - DC::getDrawableLines - face creation failed\n");
Base::Console().Log("INFO - DC::getDrawableLines - face creation failed\n");
return result;
}
TopoDS_Face face = mkFace.Face();
@ -263,11 +227,10 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines()
Bnd_Box bBox;
BRepBndLib::Add(face, bBox);
bBox.SetGap(0.0);
// face & box are done!
for (auto& ls: m_lineSets) {
for (auto& ls: lineSets) {
HatchLine hl = ls.getHatchLine();
std::vector<TopoDS_Edge> candidates = DrawCrosshatch::makeEdgeOverlay(hl, bBox);
std::vector<TopoDS_Edge> candidates = DrawCrosshatch::makeEdgeOverlay(hl, bBox, scale);
//make Compound for this linespec
BRep_Builder builder;
@ -281,7 +244,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines()
BRepAlgoAPI_Common mkCommon(face, Comp);
if ((!mkCommon.IsDone()) ||
(mkCommon.Shape().IsNull()) ) {
Base::Console().Message("TRACE - DC::getDrawableLines - Common creation failed\n");
Base::Console().Log("INFO - DC::getDrawableLines - Common creation failed\n");
return result;
}
TopoDS_Shape common = mkCommon.Shape();
@ -294,12 +257,12 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines()
for ( int i = 1 ; i <= mapOfEdges.Extent() ; i++ ) {
const TopoDS_Edge& edge = TopoDS::Edge(mapOfEdges(i));
if (edge.IsNull()) {
Base::Console().Message("TRACE - DC::getDrawableLines - edge: %d is NULL\n",i);
Base::Console().Log("INFO - DC::getDrawableLines - edge: %d is NULL\n",i);
continue;
}
TechDrawGeometry::BaseGeom* base = BaseGeom::baseFactory(edge);
if (base == nullptr) {
Base::Console().Message("TRACE - DC::getDrawableLines - baseFactory failed for edge: %d\n",i);
Base::Console().Log("FAIL - DC::getDrawableLines - baseFactory failed for edge: %d\n",i);
throw Base::Exception("GeometryObject::addGeomFromCompound - baseFactory failed");
}
resultGeoms.push_back(base);
@ -311,8 +274,8 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines()
}
return result;
}
std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b)
/* static */
std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b, double scale)
{
std::vector<TopoDS_Edge> result;
@ -322,7 +285,8 @@ std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b
Base::Vector3d start;
Base::Vector3d end;
Base::Vector3d origin = hl.getOrigin();
double interval = hl.getInterval() * ScalePattern.getValue();
// double interval = hl.getInterval() * ScalePattern.getValue();
double interval = hl.getInterval() * scale;
double angle = hl.getAngle();
//only dealing with angles -180:180 for now
@ -422,6 +386,30 @@ TopoDS_Edge DrawCrosshatch::makeLine(Base::Vector3d s, Base::Vector3d e)
return result;
}
void DrawCrosshatch::getParameters(void)
{
//this is probably "/build/data/Mod/TechDraw/PAT"
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/PAT/";
std::string defaultFileName = defaultDir + "FCStd.pat";
QString patternFileName = QString::fromStdString(hGrp->GetASCII("FilePattern",defaultFileName.c_str()));
if (patternFileName.isEmpty()) {
patternFileName = QString::fromStdString(defaultFileName);
}
QFileInfo tfi(patternFileName);
if (tfi.isReadable()) {
FilePattern.setValue(patternFileName.toUtf8().constData());
}
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
std::string defaultNamePattern = "Diamond";
NamePattern.setValue(hGrp->GetASCII("NamePattern",defaultNamePattern.c_str()));
}
PyObject *DrawCrosshatch::getPyObject(void)
{
if (PythonObject.is(Py::_None())) {

View File

@ -28,15 +28,20 @@
# include <App/PropertyLinks.h>
#include <App/PropertyFile.h>
#include "HatchLine.h"
#include "Geometry.h"
class TopoDS_Edge;
class Bnd_Box;
namespace TechDrawGeometry
{
class BaseGeom;
}
namespace TechDraw
{
class DrawViewPart;
class HatchLine;
class LineSet;
class DashSet;
class TechDrawExport DrawCrosshatch : public App::DocumentObject
{
@ -46,14 +51,10 @@ public:
DrawCrosshatch();
virtual ~DrawCrosshatch();
App::PropertyVector DirProjection; //Source is only valid for original projection?
App::PropertyLinkSub Source; //the dvp & face this crosshatch belongs to
App::PropertyLinkSub Source; //the dvX & face(s) this crosshatch belongs to
App::PropertyFile FilePattern;
App::PropertyString NamePattern;
App::PropertyFloat ScalePattern;
// App::PropertyFloat WeightPattern;
// App::PropertyColor ColorPattern;
// App::PropertyStringList LineSpecs;
virtual short mustExecute() const;
virtual App::DocumentObjectExecReturn *execute(void);
@ -63,15 +64,18 @@ public:
}
virtual PyObject *getPyObject(void);
std::vector<LineSet> getDrawableLines();
DrawViewPart* getSourceView(void) const;
void adviseParent(void) const; //don't like this!
std::vector<LineSet> getDrawableLines(int i = 0);
static std::vector<LineSet> getDrawableLines(DrawViewPart* dvp, std::vector<LineSet> lineSets, int iface, double scale);
static std::vector<TopoDS_Edge> makeEdgeOverlay(HatchLine hl, Bnd_Box bBox, double scale);
static TopoDS_Edge makeLine(Base::Vector3d s, Base::Vector3d e);
static std::vector<HatchLine> getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern);
protected:
TopoDS_Edge makeLine(Base::Vector3d s, Base::Vector3d e);
void getParameters(void);
std::vector<HatchLine> getDecodedSpecsFromFile();
std::vector<TopoDS_Edge> makeEdgeOverlay(HatchLine hl, Bnd_Box bBox);
std::vector<LineSet> m_lineSets;
private:

View File

@ -58,16 +58,20 @@
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <GeomLib_Tool.hxx>
#endif
#include <limits>
#include <algorithm>
#include <cmath>
#include <GeomLib_Tool.hxx>
#include <App/Application.h>
#include <App/Document.h>
@ -80,6 +84,7 @@
#include "DrawUtil.h"
#include "DrawViewSection.h"
#include "DrawProjectSplit.h"
#include "Geometry.h"
#include "GeometryObject.h"
#include "DrawViewPart.h"

View File

@ -37,10 +37,14 @@
#include <Base/BoundBox.h>
#include "DrawView.h"
#include "DrawProjectSplit.h"
class gp_Pnt;
class gp_Pln;
class gp_Ax2;
//class TopoDS_Edge;
//class TopoDS_Vertex;
//class TopoDS_Wire;
//class TopoDS_Shape;
namespace TechDrawGeometry
{
@ -53,6 +57,8 @@ class Face;
namespace TechDraw {
class DrawHatch;
class DrawCrosshatch;
class DrawProjectSplit;
class DrawViewSection;
}
namespace TechDraw
@ -141,7 +147,7 @@ public:
bool isDeleting(void) { return nowDeleting; }
gp_Pln getProjPlane(void) const;
std::vector<TopoDS_Wire> getWireForFace(int idx) const;
virtual std::vector<TopoDS_Wire> getWireForFace(int idx) const;
protected:

View File

@ -46,6 +46,7 @@
#include <HLRBRep_Algo.hxx>
#include <HLRAlgo_Projector.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <ShapeAnalysis.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
@ -63,20 +64,24 @@
# include <QFileInfo>
#include <App/Application.h>
#include <App/Document.h>
#include <App/Material.h>
#include <Base/BoundBox.h>
#include <Base/Exception.h>
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <Base/Parameter.h>
#include <Mod/Part/App/PartFeature.h>
#include "Geometry.h"
#include "GeometryObject.h"
#include "HatchLine.h"
#include "EdgeWalker.h"
#include "DrawUtil.h"
#include "DrawProjGroupItem.h"
#include "DrawProjectSplit.h"
#include "DrawCrosshatch.h"
#include "DrawViewSection.h"
using namespace TechDraw;
@ -110,13 +115,18 @@ DrawViewSection::DrawViewSection()
SectionDirection.setEnums(SectionDirEnums);
ADD_PROPERTY_TYPE(SectionDirection,((long)0),sgroup, App::Prop_None, "Direction in Base View for this Section");
ADD_PROPERTY_TYPE(ShowCutSurface ,(true),fgroup,App::Prop_None,"Shade 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(HatchPattern ,(""),fgroup,App::Prop_None,"The hatch pattern file for the cut surface");
ADD_PROPERTY_TYPE(HatchColor,(0.0,0.0,0.0),fgroup,App::Prop_None,"The color of the hatch pattern");
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(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();
}
@ -159,6 +169,23 @@ void DrawViewSection::onChanged(const App::Property* prop)
}
}
}
if (prop == &FileHatchPattern ||
prop == &NameGeomPattern ) {
if ((!FileHatchPattern.isEmpty()) &&
(!NameGeomPattern.isEmpty())) {
std::vector<HatchLine> specs =
DrawCrosshatch::getDecodedSpecsFromFile(FileHatchPattern.getValue(),NameGeomPattern.getValue());
m_lineSets.clear();
for (auto& hl: specs) {
//hl.dump("hl from section");
LineSet ls;
ls.setHatchLine(hl);
m_lineSets.push_back(ls);
}
}
}
DrawView::onChanged(prop);
}
@ -249,10 +276,12 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
inputCenter,
Scale.getValue());
sectionFaceWires.clear();
TopoDS_Compound newFaces;
BRep_Builder builder;
builder.MakeCompound(newFaces);
TopExp_Explorer expl(mirroredSection, TopAbs_FACE);
int idb = 0;
for (; expl.More(); expl.Next()) {
const TopoDS_Face& face = TopoDS::Face(expl.Current());
TopoDS_Face pFace = projectFace(face,
@ -260,8 +289,9 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
Direction.getValue());
if (!pFace.IsNull()) {
builder.Add(newFaces,pFace);
sectionFaceWires.push_back(ShapeAnalysis::OuterWire(pFace));
}
idb++;
}
sectionFaces = newFaces;
}
@ -506,6 +536,20 @@ Base::Vector3d DrawViewSection::getSectionVector (const std::string sectionName)
return adjResult;
}
std::vector<LineSet> DrawViewSection::getDrawableLines(int i)
{
std::vector<LineSet> result;
result = DrawCrosshatch::getDrawableLines(this,m_lineSets,i,HatchScale.getValue());
return result;
}
std::vector<TopoDS_Wire> DrawViewSection::getWireForFace(int idx) const
{
std::vector<TopoDS_Wire> result;
result.push_back(sectionFaceWires.at(idx));
return result;
}
void DrawViewSection::unsetupObject()
{
getBaseDVP()->touch();
@ -534,13 +578,6 @@ TechDraw::DrawProjGroupItem* DrawViewSection::getBaseDPGI()
void DrawViewSection::getParameters()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color cutColor = App::Color((uint32_t) hGrp->GetUnsigned("CutSurfaceColor", 0xC8C8C800));
CutSurfaceColor.setValue(cutColor);
App::Color hatchColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionHatchColor", 0x00000000));
HatchColor.setValue(hatchColor);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw");
std::string defaultDir = App::Application::getResourceDir() + "Mod/Drawing/patterns/";
@ -551,9 +588,10 @@ void DrawViewSection::getParameters()
}
QFileInfo tfi(patternFileName);
if (tfi.isReadable()) {
HatchPattern.setValue(patternFileName.toUtf8().constData());
FileHatchPattern.setValue(patternFileName.toUtf8().constData());
}
std::string patternName = hGrp->GetASCII("PatternName","Diamond");
NameGeomPattern.setValue(patternName);
}
// Python Drawing feature ---------------------------------------------------------

View File

@ -45,16 +45,16 @@ class Face;
namespace TechDraw
{
class DrawProjGroupItem;
class DrawCrosshatch;
class HatchLine;
class LineSet;
class DashSet;
/** Base class of all View Features in the drawing module
*/
class TechDrawExport DrawViewSection : public DrawViewPart
{
PROPERTY_HEADER(Part::DrawViewSection);
public:
/// Constructor
DrawViewSection(void);
virtual ~DrawViewSection();
@ -62,24 +62,16 @@ public:
App::PropertyVector SectionNormal;
App::PropertyVector SectionOrigin;
App::PropertyEnumeration SectionDirection;
App::PropertyBool ShowCutSurface;
App::PropertyColor CutSurfaceColor;
App::PropertyBool HatchCutSurface;
App::PropertyFile HatchPattern;
App::PropertyColor HatchColor;
App::PropertyFile FileHatchPattern;
App::PropertyString NameGeomPattern;
App::PropertyFloat HatchScale;
App::PropertyString SectionSymbol;
virtual short mustExecute() const;
bool isReallyInBox (const Base::Vector3d v, const Base::BoundBox3d bb) const;
/** @name methods overide Feature */
//@{
/// recalculate the Feature
virtual App::DocumentObjectExecReturn *execute(void);
virtual void onChanged(const App::Property* prop);
//@}
/// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderViewSection";
}
@ -91,10 +83,20 @@ public:
TechDraw::DrawProjGroupItem* getBaseDPGI();
virtual void unsetupObject();
virtual std::vector<TopoDS_Wire> getWireForFace(int idx) const;
TopoDS_Compound getSectionFaces() { return sectionFaces;};
std::vector<TopoDS_Wire> getSectionFaceWires(void) { return sectionFaceWires; }
std::vector<LineSet> getDrawableLines(int i = 0);
std::vector<HatchLine> getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern);
static const char* SectionDirEnums[];
protected:
TopoDS_Compound sectionFaces;
std::vector<TopoDS_Wire> sectionFaceWires;
std::vector<LineSet> m_lineSets;
gp_Pln getSectionPlane() const;
TopoDS_Compound findSectionPlaneIntersections(const TopoDS_Shape& shape);

View File

@ -34,6 +34,7 @@
#include "Geometry.h"
namespace TechDraw
{
class DrawViewPart;
@ -43,6 +44,10 @@ class DrawView;
namespace TechDrawGeometry
{
class BaseGeom;
class Vector;
class Face;
class Vertex;
//! scales & mirrors a shape about a center
TopoDS_Shape TechDrawExport mirrorShape(const TopoDS_Shape &input,

View File

@ -30,7 +30,12 @@
#include <stdexcept>
#endif
#include <TopoDS_Edge.hxx>
#include <Base/Console.h>
#include <Base/Vector3D.h>
#include "Geometry.h"
#include "DrawUtil.h"
#include "HatchLine.h"

View File

@ -31,7 +31,12 @@
#include <Base/Vector3D.h>
#include "Geometry.h"
class TopoDS_Edge;
namespace TechDrawGeometry
{
class BaseGeom;
}
namespace TechDraw
{
@ -40,6 +45,7 @@ class DrawUtil;
// HatchLine is the result of parsing a line from PAT file into accessible parameters
// e /HatchLine/PATSpecLine/
class HatchLine
{
public:
@ -65,7 +71,7 @@ public:
private:
void init(void);
std::vector<double> split(std::string line);
//PAT line extracted tokens
double m_angle;
Base::Vector3d m_origin;
double m_interval;
@ -73,7 +79,7 @@ private:
std::vector<double> m_dashParms; //why isn't this a DashSpec object?
};
// a LineSet is all the generated edges for a HatchLine
// a LineSet is all the generated edges for 1 HatchLine for 1 Face
class LineSet
{
public:
@ -88,6 +94,7 @@ public:
std::vector<double> getDashSpec(void) { return m_hatchLine.getDashParms();}
std::vector<TopoDS_Edge> getEdges(void) { return m_edges; }
std::vector<TechDrawGeometry::BaseGeom*> getGeoms(void) { return m_geoms; }
//void clearGeom(void);
private:
std::vector<TopoDS_Edge> m_edges;

View File

@ -74,8 +74,8 @@ QGIFace::QGIFace(int index) :
m_styleNormal = m_styleDef;
m_fillStyle = m_styleDef;
m_colNormalFill = m_colDefFill;
setCrosshatchColor(QColor(Qt::black));
setCrosshatchWeight(0.5); //0 = cosmetic
m_crossColor = QColor(Qt::black);
setLineWeight(0.5); //0 = cosmetic
setPrettyNormal();
m_texture = nullptr; //empty texture
@ -247,31 +247,27 @@ void QGIFace::clearFillItems(void)
}
}
void QGIFace::setCrosshatchColor(const QColor& c)
{
m_crossColor = c;
}
//convert from PAT style "-1,0,-1,+1" to Qt style "mark,space,mark,space"
QVector<qreal> QGIFace::decodeDashSpec(DashSpec patDash)
{
//Rez::guiX(something)?
double dotLength = 3.0; //guess work!
double dotLength = 3.0;
double unitLength = 6.0;
//double penWidth = m_crossWeight;
// double penWidth = m_crossWeight; //mark, space and dot lengths are to be in terms of penWidth(Qt) or mm(PAT)??
// //if we want it in terms of mm, we need to divide by penWidth?
// double minPen = 0.01; //avoid trouble with cosmetic pen (zero width)
std::vector<double> result;
std::string prim;
for (auto& d: patDash.get()) {
double strokeLength;
if (DrawUtil::fpCompare(d,0.0)) { //pat dot
strokeLength = dotLength;
result.push_back(strokeLength);
} else if (Rez::guiX(d) < 0) { //pat space
strokeLength = fabs(Rez::guiX(d)) * unitLength;
result.push_back(strokeLength);
} else { //pat dash
strokeLength = Rez::guiX(d) * unitLength;
result.push_back(strokeLength);
}
result.push_back(strokeLength);
}
return QVector<qreal>::fromStdVector( result );
}
@ -284,8 +280,8 @@ QPen QGIFace::setCrossPen(int i)
//ourSpec.dump("our spec");
QPen result;
// result.setWidthF(m_crossWeight);
result.setWidthF(Rez::guiX(0.09));
result.setWidthF(Rez::guiX(m_crossWeight)); //Rez::guiX() ?? line weights are in mm?
// result.setWidthF(Rez::guiX(0.09));
result.setColor(m_crossColor);
if (ourSpec.empty()) {
result.setStyle(Qt::SolidLine);
@ -349,11 +345,10 @@ QPixmap QGIFace::textureFromSvg(std::string fileSpec)
return result;
}
//c is a CSS color ie "#000000"
//set hatch color before building hatch
void QGIFace::setHatchColor(std::string c)
void QGIFace::setHatchColor(App::Color c)
{
m_svgCol = c;
m_svgCol = c.asCSSString();
m_crossColor = c.asValue<QColor>();
}
void QGIFace::setHatchScale(double s)
@ -400,6 +395,10 @@ void QGIFace::resetFill() {
m_styleNormal = m_styleDef;
}
void QGIFace::setLineWeight(double w) {
m_crossWeight = w;
}
QRectF QGIFace::boundingRect() const
{

View File

@ -87,25 +87,25 @@ public:
void setFill(QColor c, Qt::BrushStyle s);
void setFill(QBrush b);
void resetFill();
//general hatch parms & methods
void setHatchColor(App::Color c);
void setHatchScale(double s);
//svg fill parms & methods
void setHatchFile(std::string fileSpec);
void setHatchColor(std::string c);
void setHatchScale(double s);
void loadSvgHatch(std::string fileSpec);
void buildSvgHatch(void);
void toggleSvg(bool b);
void clearSvg(void);
//PAT fill parms & methods
// void setCrosshatch(const QPainterPath& p);
void setCrosshatchColor(const QColor& c);
void setCrosshatchWeight(double w) { m_crossWeight = w; }
//void setLineSets(std::vector<LineSet> ls);
void clearLineSets(void);
void addLineSet(QPainterPath pp, std::vector<double> dp);
QGraphicsPathItem* addFillItem();
void clearFillItems(void);
void setLineWeight(double w);
//bitmap texture fill parms method
QPixmap textureFromBitmap(std::string fileSpec);
@ -126,7 +126,6 @@ protected:
QPen setCrossPen(int i);
QVector<qreal> decodeDashSpec(DashSpec d);
// QGraphicsPathItem* m_fillItem;
std::vector<QGraphicsPathItem*> m_fillItems;
std::vector<QPainterPath> m_crossHatchPaths; // 0/1 dashspec per crosshatchpath
std::vector<DashSpec> m_dashSpecs;

View File

@ -388,36 +388,39 @@ void QGIViewPart::drawViewPart()
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
TechDraw::DrawCrosshatch* fCross = faceIsCrosshatched(i,crossObjs);
if (fCross) {
std::vector<LineSet> lineSets = fCross->getDrawableLines();
if (!lineSets.empty()) {
newFace->clearLineSets();
for (auto& ls: lineSets) {
QPainterPath bigPath;
for (auto& g: ls.getGeoms()) {
QPainterPath smallPath = drawPainterPath(g);
bigPath.addPath(smallPath);
const std::vector<std::string> &sourceNames = fCross->Source.getSubValues();
if (!sourceNames.empty()) {
int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0));
std::vector<LineSet> lineSets = fCross->getDrawableLines(fdx);
if (!lineSets.empty()) {
newFace->clearLineSets();
for (auto& ls: lineSets) {
QPainterPath bigPath;
for (auto& g: ls.getGeoms()) {
QPainterPath smallPath = drawPainterPath(g);
bigPath.addPath(smallPath);
}
newFace->addLineSet(bigPath,ls.getDashSpec());
}
newFace->isHatched(true);
newFace->setFillMode(QGIFace::CrosshatchFill);
newFace->setHatchScale(fCross->ScalePattern.getValue());
newFace->setHatchFile(fCross->FilePattern.getValue());
Gui::ViewProvider* gvp = QGIView::getViewProvider(fCross);
ViewProviderCrosshatch* crossVp = dynamic_cast<ViewProviderCrosshatch*>(gvp);
if (crossVp != nullptr) {
newFace->setHatchColor(crossVp->ColorPattern.getValue());
newFace->setLineWeight(crossVp->WeightPattern.getValue());
}
newFace->addLineSet(bigPath,ls.getDashSpec());
}
newFace->isHatched(true);
newFace->setFillMode(QGIFace::CrosshatchFill);
newFace->setHatchScale(fCross->ScalePattern.getValue());
Gui::ViewProvider* gvp = QGIView::getViewProvider(fCross);
ViewProviderCrosshatch* crossVp = dynamic_cast<ViewProviderCrosshatch*>(gvp);
if (crossVp != nullptr) {
App::Color hColor = crossVp->ColorPattern.getValue();
newFace->setCrosshatchColor(hColor.asValue<QColor>());
// newFace->setLineWeight(crossVp->WeightPattern.getValue());
}
}
} else if (fHatch) {
if (!fHatch->HatchPattern.isEmpty()) {
newFace->setHatchFile(fHatch->HatchPattern.getValue());
App::Color hColor = fHatch->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatchScale(fHatch->HatchScale.getValue());
newFace->isHatched(true);
newFace->setFillMode(QGIFace::FromFile);
newFace->setHatchFile(fHatch->HatchPattern.getValue());
newFace->setHatchScale(fHatch->HatchScale.getValue());
newFace->setHatchColor(fHatch->HatchColor.getValue());
}
}
newFace->setDrawEdges(true);

View File

@ -26,6 +26,8 @@
#include <QAction>
#include <QApplication>
#include <QContextMenuEvent>
#include <QFile>
#include <QFileInfo>
#include <QGraphicsScene>
#include <QMenu>
#include <QMouseEvent>
@ -38,10 +40,14 @@
#include <qmath.h>
#include <Base/Console.h>
#include <App/Material.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h>
#include <Mod/TechDraw/App/DrawViewSection.h>
#include "ZVALUE.h"
#include "ViewProviderViewSection.h"
#include "QGIFace.h"
#include "QGIViewSection.h"
@ -64,7 +70,13 @@ void QGIViewSection::drawSectionFace()
return;
}
if ( !section->hasGeometry() || !section->ShowCutSurface.getValue() ) {
if ( !section->hasGeometry()) {
return;
}
Gui::ViewProvider* gvp = QGIView::getViewProvider(section);
ViewProviderViewSection* sectionVp = dynamic_cast<ViewProviderViewSection*>(gvp);
if ((sectionVp == nullptr) ||
(!sectionVp->ShowCutSurface.getValue())) {
return;
}
@ -73,9 +85,11 @@ void QGIViewSection::drawSectionFace()
//Base::Console().Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
return;
}
std::vector<TechDrawGeometry::Face *>::iterator fit = sectionFaces.begin();
QColor faceColor = section->CutSurfaceColor.getValue().asValue<QColor>();
for(; fit != sectionFaces.end(); fit++) {
QColor faceColor = (sectionVp->CutSurfaceColor.getValue()).asValue<QColor>();
int i = 0;
for(; fit != sectionFaces.end(); fit++, i++) {
QGIFace* newFace = drawFace(*fit,-1);
newFace->setZValue(ZVALUE::SECTIONFACE);
if (section->showSectionEdges()) {
@ -83,14 +97,39 @@ void QGIViewSection::drawSectionFace()
} else {
newFace->setDrawEdges(false);
}
if (section->HatchCutSurface.getValue()) {
App::Color hColor = section->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatchFile(section->HatchPattern.getValue());
newFace->setHatchScale(section->HatchScale.getValue());
newFace->isHatched(true);
}
newFace->setFill(faceColor, Qt::SolidPattern);
if (sectionVp->HatchCutSurface.getValue()) {
newFace->isHatched(true);
newFace->setFillMode(QGIFace::FromFile);
newFace->setHatchColor(sectionVp->HatchColor.getValue());
newFace->setHatchScale(section->HatchScale.getValue());
std::string hatchFile = section->FileHatchPattern.getValue();
newFace->setHatchFile(hatchFile);
std::string patternName = section->NameGeomPattern.getValue();
QFileInfo hfi(QString::fromUtf8(hatchFile.data(),hatchFile.size()));
if (hfi.isReadable()) {
QString ext = hfi.suffix();
if ((ext.toUpper() == QString::fromUtf8("PAT")) &&
!patternName.empty() ) {
newFace->setFillMode(QGIFace::CrosshatchFill);
newFace->setLineWeight(sectionVp->WeightPattern.getValue());
std::vector<LineSet> lineSets = section->getDrawableLines(i);
if (!lineSets.empty()) {
newFace->clearLineSets();
for (auto& ls: lineSets) {
QPainterPath bigPath;
for (auto& g: ls.getGeoms()) {
QPainterPath smallPath = drawPainterPath(g);
bigPath.addPath(smallPath);
}
newFace->addLineSet(bigPath,ls.getDashSpec());
}
}
}
}
}
newFace->draw();
newFace->setPrettyNormal();
newFace->setAcceptHoverEvents(false);

View File

@ -36,11 +36,23 @@
#include <Base/Exception.h>
#include <Base/Sequencer.h>
//#include <Gui/SoFCSelection.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/Selection.h>
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Gui/Application.h>
#include <Gui/Selection.h>
#include <Gui/MainWindow.h>
#include <Gui/Utilities.h>
#include <Gui/Control.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h>
#include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/DrawView.h>
#include "ViewProviderDrawingView.h"
#include "ViewProviderCrosshatch.h"
using namespace TechDrawGui;
@ -55,11 +67,11 @@ ViewProviderCrosshatch::ViewProviderCrosshatch()
static const char *vgroup = "Format";
sPixmap = "actions/techdraw-crosshatch";
App::Color fcColor;
fcColor.setPackedValue(0x00000000);
ADD_PROPERTY_TYPE(ColorPattern,(fcColor),vgroup,App::Prop_None,"The color of the pattern");
ADD_PROPERTY_TYPE(WeightPattern,(0.0),vgroup,App::Prop_None,"Crosshatch pattern line thickness");
ADD_PROPERTY_TYPE(ColorPattern,(0),vgroup,App::Prop_None,"The color of the pattern");
ADD_PROPERTY_TYPE(WeightPattern,(0.1),vgroup,App::Prop_None,"Crosshatch pattern line thickness");
getParameters();
}
@ -89,7 +101,10 @@ std::vector<std::string> ViewProviderCrosshatch::getDisplayModes(void) const
//for VP properties
void ViewProviderCrosshatch::onChanged(const App::Property* prop)
{
// Base::Console().Message("TRACE - VPC::onChanged(%s)\n",prop->getName());
if (prop == &WeightPattern ||
prop == &ColorPattern ) {
updateGraphic();
}
Gui::ViewProviderDocumentObject::onChanged(prop);
}
@ -97,29 +112,46 @@ void ViewProviderCrosshatch::onChanged(const App::Property* prop)
//for feature properties
void ViewProviderCrosshatch::updateData(const App::Property* prop)
{
// Base::Console().Message("TRACE - VPC::updateData(%s)\n",prop->getName());
if (prop == &WeightPattern ||
prop == &ColorPattern ||
prop == &(getViewObject()->ScalePattern)) {
//Base::Console().Message("TRACE - VPC::updateData - should update parent now\n");
//how does QGIVP find this VP to get properties?
// Gui::ViewProvider* view = Application::Instance->getDocument(it->pDoc)->getViewProvider(it->pObject);
// TechDraw::DrawPage* fp = dynamic_cast<TechDraw::DrawPage*>(getDocument()->getObject(PageName.c_str()));
// Gui::ViewProvider* vp = Gui::Application::Instance->getDocument(getDocument())->getViewProvider(fp);
// TechDrawGui::ViewProviderPage* dvp = dynamic_cast<TechDrawGui::ViewProviderPage*>(vp);
// if (dvp) {
// dvp->show();
// redraw QGIVP
//QGIView* qgiv = getQView(); this will be different have to find source's QView
// if (qgiv) {
// qgiv->updateView(true);
// }
}
if (prop == &(getViewObject()->ScalePattern)) {
updateGraphic();
}
Gui::ViewProviderDocumentObject::updateData(prop);
}
void ViewProviderCrosshatch::updateGraphic(void)
{
TechDraw::DrawCrosshatch* dc = getViewObject();
if (dc) {
TechDraw::DrawViewPart* dvp = dc->getSourceView();
if (dvp) {
Gui::ViewProvider* view = Gui::Application::Instance->getDocument(dvp->getDocument())->getViewProvider(dvp);
TechDrawGui::ViewProviderDrawingView* vpDV = dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(view);
if (vpDV) {
vpDV->show();
QGIView* qgiv = vpDV->getQView();
if (qgiv) {
qgiv->updateView(true);
}
}
}
}
}
void ViewProviderCrosshatch::getParameters(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Crosshatch", 0x00000000));
ColorPattern.setValue(fcColor);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
double lineWeight = hGrp->GetFloat("GeomWeight",0.1);
WeightPattern.setValue(lineWeight);
}
TechDraw::DrawCrosshatch* ViewProviderCrosshatch::getViewObject() const
{
return dynamic_cast<TechDraw::DrawCrosshatch*>(pcObject);

View File

@ -31,6 +31,7 @@
#include <Gui/ViewProviderFeature.h>
namespace TechDraw{
class DrawCrosshatch;
}
@ -59,6 +60,8 @@ public:
virtual bool useNewSelectionModel(void) const {return false;}
virtual void setDisplayMode(const char* ModeName);
virtual std::vector<std::string> getDisplayModes(void) const;
void updateGraphic(void);
void getParameters(void);
TechDraw::DrawCrosshatch* getViewObject() const;
};

View File

@ -37,13 +37,9 @@
#include <App/DocumentObject.h>
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <Gui/Control.h>
#include <Gui/Document.h>
#include <Gui/Selection.h>
#include <Gui/MainWindow.h>
#include <Gui/ViewProvider.h>
#include <Gui/WaitCursor.h>
#include <Mod/TechDraw/App/DrawViewClip.h>
#include <Mod/TechDraw/App/DrawPage.h>
@ -143,13 +139,16 @@ QGIView* ViewProviderDrawingView::getQView(void)
{
QGIView *qView = nullptr;
if (m_docReady){
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(getViewObject()->getDocument());
Gui::ViewProvider* vp = guiDoc->getViewProvider(getViewObject()->findParentPage());
ViewProviderPage* dvp = dynamic_cast<ViewProviderPage*>(vp);
if (dvp) {
if (dvp->getMDIViewPage()) {
if (dvp->getMDIViewPage()->getQGVPage()) {
qView = dynamic_cast<QGIView *>(dvp->getMDIViewPage()->getQGVPage()->findView(getViewObject()));
TechDraw::DrawView* dv = getViewObject();
if (dv) {
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(getViewObject()->getDocument());
Gui::ViewProvider* vp = guiDoc->getViewProvider(getViewObject()->findParentPage());
ViewProviderPage* dvp = dynamic_cast<ViewProviderPage*>(vp);
if (dvp) {
if (dvp->getMDIViewPage()) {
if (dvp->getMDIViewPage()->getQGVPage()) {
qView = dynamic_cast<QGIView *>(dvp->getMDIViewPage()->getQGVPage()->findView(getViewObject()));
}
}
}
}

View File

@ -48,7 +48,17 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderViewSection, TechDrawGui::ViewProviderV
ViewProviderViewSection::ViewProviderViewSection()
{
static const char *sgroup = "Surface";
static const char *hgroup = "Hatch";
sPixmap = "TechDraw_Tree_Section";
ADD_PROPERTY_TYPE(ShowCutSurface ,(true),sgroup,App::Prop_None,"Show/hide the cut surface");
ADD_PROPERTY_TYPE(CutSurfaceColor,(0.0,0.0,0.0),sgroup,App::Prop_None,"The color to shade the cut surface");
ADD_PROPERTY_TYPE(HatchCutSurface ,(false),hgroup,App::Prop_None,"Hatch the cut surface");
ADD_PROPERTY_TYPE(HatchColor,(0.0,0.0,0.0),hgroup,App::Prop_None,"The color of the hatch pattern");
ADD_PROPERTY_TYPE(WeightPattern,(0.1),hgroup,App::Prop_None,"Crosshatch pattern line thickness");
getParameters();
}
ViewProviderViewSection::~ViewProviderViewSection()
@ -74,16 +84,28 @@ std::vector<std::string> ViewProviderViewSection::getDisplayModes(void) const
return StrList;
}
//for VP properties
void ViewProviderViewSection::onChanged(const App::Property* prop)
{
if (prop == &WeightPattern ||
prop == &HatchCutSurface ||
prop == &HatchColor ||
prop == &ShowCutSurface ||
prop == &CutSurfaceColor ) {
updateGraphic();
}
ViewProviderViewPart::onChanged(prop);
}
//for Feature properties
void ViewProviderViewSection::updateData(const App::Property* prop)
{
if (prop == &(getViewObject()->ShowCutSurface) ||
prop == &(getViewObject()->CutSurfaceColor) ) {
// redraw QGIVP
QGIView* qgiv = getQView();
if (qgiv) {
qgiv->updateView(true);
}
}
if (prop == &(getViewObject()->FileHatchPattern) ||
prop == &(getViewObject()->NameGeomPattern) ||
prop == &(getViewObject()->HatchScale) ) {
updateGraphic();
}
ViewProviderViewPart::updateData(prop);
}
@ -93,6 +115,30 @@ std::vector<App::DocumentObject*> ViewProviderViewSection::claimChildren(void) c
return ViewProviderViewPart::claimChildren();
}
void ViewProviderViewSection::updateGraphic(void)
{
// redraw QGIVP
QGIView* qgiv = getQView();
if (qgiv) {
qgiv->updateView(true);
}
}
void ViewProviderViewSection::getParameters(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color cutColor = App::Color((uint32_t) hGrp->GetUnsigned("CutSurfaceColor", 0xC8C8C800));
CutSurfaceColor.setValue(cutColor);
App::Color hatchColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionHatchColor", 0x00000000));
HatchColor.setValue(hatchColor);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
double lineWeight = hGrp->GetFloat("GeomWeight",0.1);
WeightPattern.setValue(lineWeight);
}
TechDraw::DrawViewSection* ViewProviderViewSection::getViewObject() const
{
return dynamic_cast<TechDraw::DrawViewSection*>(pcObject);

View File

@ -44,14 +44,25 @@ public:
/// destructor
virtual ~ViewProviderViewSection();
App::PropertyBool ShowCutSurface;
App::PropertyColor CutSurfaceColor;
App::PropertyBool HatchCutSurface;
App::PropertyColor HatchColor;
App::PropertyFloat WeightPattern;
virtual void attach(App::DocumentObject *);
virtual void setDisplayMode(const char* ModeName);
/// returns a list of all possible modes
virtual std::vector<std::string> getDisplayModes(void) const;
virtual void updateData(const App::Property*);
virtual void onChanged(const App::Property *prop);
virtual std::vector<App::DocumentObject*> claimChildren(void) const;
void updateGraphic(void);
void getParameters(void);
virtual TechDraw::DrawViewSection* getViewObject() const;
};