Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into feature/tooltable
  • Loading branch information
dubstar-04 committed Aug 26, 2019
2 parents 27d3b57 + 48e91bd commit 5c0fbe7
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 160 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,6 +20,7 @@ ui_*.h
moc_*.cpp
Makefile
CMakeCache.txt
CMakeLists.txt.user
config.h
install_manifest.txt
/bin/
Expand Down
27 changes: 19 additions & 8 deletions src/Gui/SoFCVectorizeSVGAction.cpp
Expand Up @@ -31,6 +31,7 @@

#include <qglobal.h>
#include <Base/FileInfo.h>
#include <Base/Console.h>
#include "SoFCVectorizeSVGAction.h"

using namespace Gui;
Expand Down Expand Up @@ -306,7 +307,7 @@ void SoFCVectorizeSVGActionP::printTriangle(const SbVec3f * v, const SbColor * c
<< "; stroke:#"
<< std::hex << std::setw(6) << std::setfill('0') << (cc >> 8)
<< ";" << std::endl
<< " stroke-width:1.0;" << std::endl
<< " stroke-width:" << publ->getLineWidth() << ";" << std::endl
<< " stroke-linecap:round;stroke-linejoin:round\"/>" << std::endl;
}

Expand Down Expand Up @@ -350,8 +351,9 @@ void SoFCVectorizeSVGActionP::printLine(const SoVectorizeLine * item) const
<< "x1=\"" << v[0][0] << "\" y1=\"" << v[0][1] << "\" "
<< "x2=\"" << v[1][0] << "\" y2=\"" << v[1][1] << "\" "
<< "stroke=\"#"
<< std::hex << std::setw(6) << std::setfill('0') << (cc >> 8)
<< "\" stroke-width=\"1px\" />\n";
<< std::hex << std::setw(6) << std::setfill('0') << (cc >> 8) << "\""
<< " stroke-linecap=\"square\" "
<< " stroke-width=\"" << publ->getLineWidth() << "\" />\n";
}

void SoFCVectorizeSVGActionP::printPoint(const SoVectorizePoint * item) const
Expand All @@ -375,7 +377,10 @@ void SoFCVectorizeSVGAction::initClass(void)
SO_ACTION_INIT_CLASS(SoFCVectorizeSVGAction, SoVectorizeAction);
}

SoFCVectorizeSVGAction::SoFCVectorizeSVGAction()
SoFCVectorizeSVGAction::SoFCVectorizeSVGAction() :
m_backgroundState(true),
m_lineWidth(1.0),
m_usemm(false)
{
SO_ACTION_CONSTRUCTOR(SoFCVectorizeSVGAction);
this->setOutput(new SoSVGVectorOutput);
Expand All @@ -400,12 +405,18 @@ void SoFCVectorizeSVGAction::printHeader(void) const
str << "<!-- Created with FreeCAD (http://www.freecadweb.org) -->" << std::endl;
str << "<svg xmlns=\"http://www.w3.org/2000/svg\"" << std::endl;
str << " xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:ev=\"http://www.w3.org/2001/xml-events\"" << std::endl;
str << " version=\"1.1\" baseProfile=\"full\"" << std::endl;
str << " version=\"1.1\" baseProfile=\"full\"" << std::endl;

SbVec2f size = getPageSize();
if (this->getOrientation() == LANDSCAPE)
if (this->getOrientation() == LANDSCAPE) {
SbSwap<float>(size[0], size[1]);
str << " width=\"" << size[0] << "\" height=\"" << size[1] << "\">" << std::endl;
}
if (getUseMM()) {
str << " width=\"" << size[0] << "mm\" height=\"" << size[1] << "mm\""<< std::endl;
str << " viewBox=\"0 0 " << size[0] << " " << size[1] << "\">" << std::endl;
} else { //original code used px
str << " width=\"" << size[0] << "\" height=\"" << size[1] << "\">" << std::endl;
}
str << "<g>" << std::endl;
}

Expand Down Expand Up @@ -447,7 +458,7 @@ void SoFCVectorizeSVGAction::printBackground(void) const
str << " style=\"fill:#"
<< std::hex << std::setw(6) << std::setfill('0') << (cc >> 8)
<< ";fill-opacity:1;fill-rule:evenodd;stroke:none;"
"stroke-width:1px;stroke-linecap:butt;stroke-linejoin:"
"stroke-width:" << getLineWidth() << ";stroke-linecap:butt;stroke-linejoin:"
"miter;stroke-opacity:1\" />\n";
str << "<g>" << std::endl;
}
Expand Down
10 changes: 10 additions & 0 deletions src/Gui/SoFCVectorizeSVGAction.h
Expand Up @@ -62,6 +62,13 @@ class GuiExport SoFCVectorizeSVGAction : public SoVectorizeAction {
static void initClass(void);
SoSVGVectorOutput * getSVGOutput(void) const;

virtual void setBackgroundState(bool b) { m_backgroundState = b; }
virtual bool getBackgroundState(void) const { return m_backgroundState; }
virtual void setLineWidth(double w) { m_lineWidth = w; }
virtual double getLineWidth(void) const { return m_lineWidth; }
virtual void setUseMM(bool b) { m_usemm = b; }
virtual bool getUseMM(void) const { return m_usemm; }

protected:
virtual void printHeader(void) const;
virtual void printFooter(void) const;
Expand All @@ -72,6 +79,9 @@ class GuiExport SoFCVectorizeSVGAction : public SoVectorizeAction {
private:
SoFCVectorizeSVGActionP* p;
friend class SoFCVectorizeSVGActionP;
bool m_backgroundState;
double m_lineWidth;
bool m_usemm;
};

} // namespace Gui
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Arch/ArchIFC.py
Expand Up @@ -30,8 +30,9 @@ def onChanged(self, obj, prop):
if prop == "IfcType":
self.setupIfcAttributes(obj)
self.setupIfcComplexAttributes(obj)
if obj.getGroupOfProperty(prop) == "IFC Attributes":
self.setObjIfcAttributeValue(obj, prop, obj.getPropertyByName(prop))
if prop in obj.PropertiesList:
if obj.getGroupOfProperty(prop) == "IFC Attributes":
self.setObjIfcAttributeValue(obj, prop, obj.getPropertyByName(prop))

def setupIfcAttributes(self, obj):
ifcTypeSchema = self.getIfcTypeSchema(obj.IfcType)
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Arch/ArchStructure.py
Expand Up @@ -947,12 +947,12 @@ def updateData(self,obj,prop):
p.append([n.x,n.y,n.z])
self.coords.point.setValues(0,len(p),p)
self.pointset.numPoints.setValue(len(p))
self.lineset.coordIndex.setValues(0,len(p)+1,range(len(p))+[-1])
self.lineset.coordIndex.setValues(0,len(p)+1,list(range(len(p)))+[-1])
if hasattr(obj.ViewObject,"NodeType"):
if (obj.ViewObject.NodeType == "Area") and (len(p) > 2):
self.coords.point.set1Value(len(p),p[0][0],p[0][1],p[0][2])
self.lineset.coordIndex.setValues(0,len(p)+2,range(len(p)+1)+[-1])
self.faceset.coordIndex.setValues(0,len(p)+1,range(len(p))+[-1])
self.lineset.coordIndex.setValues(0,len(p)+2,list(range(len(p)+1))+[-1])
self.faceset.coordIndex.setValues(0,len(p)+1,list(range(len(p)))+[-1])

elif prop in ["IfcType"]:
if hasattr(obj.ViewObject,"NodeType"):
Expand Down

0 comments on commit 5c0fbe7

Please sign in to comment.