Merge pull request #333 from WandererFan/PreProd
TechDraw MultiView,ImageView,ShapeOutline
This commit is contained in:
commit
85170b3d9f
|
@ -85,6 +85,12 @@ bool Measurement::has3DReferences()
|
|||
return (References3D.getSize() > 0);
|
||||
}
|
||||
|
||||
//add a 3D reference (obj+sub) to end of list
|
||||
int Measurement::addReference3D(App::DocumentObject *obj, const std::string subName)
|
||||
{
|
||||
return addReference3D(obj,subName.c_str());
|
||||
}
|
||||
|
||||
///add a 3D reference (obj+sub) to end of list
|
||||
int Measurement::addReference3D(App::DocumentObject *obj, const char* subName)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
bool has3DReferences();
|
||||
|
||||
/// Add a reference
|
||||
int addReference3D(App::DocumentObject* obj, const std::string subName);
|
||||
int addReference3D(App::DocumentObject* obj, const char *subName);
|
||||
|
||||
MeasureType getType();
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "DrawViewDraft.h"
|
||||
#include "DrawViewArch.h"
|
||||
#include "DrawViewSpreadsheet.h"
|
||||
#include "DrawViewMulti.h"
|
||||
#include "DrawViewImage.h"
|
||||
|
||||
namespace TechDraw {
|
||||
extern PyObject* initModule();
|
||||
|
@ -68,6 +70,7 @@ PyMODINIT_FUNC initTechDraw()
|
|||
TechDraw::DrawViewSpreadsheet ::init();
|
||||
|
||||
TechDraw::DrawViewSection ::init();
|
||||
TechDraw::DrawViewMulti ::init();
|
||||
TechDraw::DrawViewDimension ::init();
|
||||
TechDraw::DrawProjGroup ::init();
|
||||
TechDraw::DrawProjGroupItem ::init();
|
||||
|
@ -79,10 +82,12 @@ PyMODINIT_FUNC initTechDraw()
|
|||
TechDraw::DrawHatch ::init();
|
||||
TechDraw::DrawViewDraft ::init();
|
||||
TechDraw::DrawViewArch ::init();
|
||||
TechDraw::DrawViewImage ::init();
|
||||
|
||||
// Python Types
|
||||
TechDraw::DrawViewPython ::init();
|
||||
TechDraw::DrawViewPartPython ::init();
|
||||
TechDraw::DrawViewMultiPython ::init();
|
||||
TechDraw::DrawTemplatePython ::init();
|
||||
TechDraw::DrawViewSymbolPython::init();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Base/VectorPy.h>
|
||||
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
|
@ -46,8 +48,10 @@
|
|||
|
||||
#include <Mod/Part/App/OCCError.h>
|
||||
|
||||
#include "DrawProjectSplit.h"
|
||||
#include "EdgeWalker.h"
|
||||
|
||||
|
||||
namespace TechDraw {
|
||||
//module level static C++ functions go here
|
||||
}
|
||||
|
@ -70,6 +74,9 @@ public:
|
|||
add_varargs_method("findOuterWire",&Module::findOuterWire,
|
||||
"wire = findOuterWire(edgeList) -- Planar graph traversal finds OuterWire in edge pile."
|
||||
);
|
||||
add_varargs_method("findShapeOutline",&Module::findShapeOutline,
|
||||
"wire = findShapeOutline(shape,scale,direction) -- Project shape in direction and find outer wire of result."
|
||||
);
|
||||
initialize("This is a module for making drawings"); // register with Python
|
||||
}
|
||||
virtual ~Module() {}
|
||||
|
@ -219,6 +226,62 @@ private:
|
|||
}
|
||||
return Py::asObject(outerWire);
|
||||
}
|
||||
|
||||
Py::Object findShapeOutline(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *pcObjShape;
|
||||
double scale;
|
||||
PyObject *pcObjDir;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "OdO", &pcObjShape,
|
||||
&scale,
|
||||
&pcObjDir)) {
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
TopoShapePy* pShape = static_cast<TopoShapePy*>(pcObjShape);
|
||||
if (!pShape) {
|
||||
Base::Console().Message("TRACE - AATDP::findShapeOutline - input shape is null\n");
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
const TopoDS_Shape& shape = pShape->getTopoShapePtr()->getShape();
|
||||
Base::Vector3d dir = static_cast<Base::VectorPy*>(pcObjDir)->value();
|
||||
std::vector<TopoDS_Edge> edgeList;
|
||||
try {
|
||||
edgeList = DrawProjectSplit::getEdgesForWalker(shape,scale,dir);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString());
|
||||
}
|
||||
|
||||
if (edgeList.empty()) {
|
||||
Base::Console().Log("LOG - ATDP::findShapeOutline: input is empty\n");
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
PyObject* outerWire = nullptr;
|
||||
bool success = false;
|
||||
try {
|
||||
EdgeWalker ew;
|
||||
ew.loadEdges(edgeList);
|
||||
success = ew.perform();
|
||||
if (success) {
|
||||
std::vector<TopoDS_Wire> rw = ew.getResultNoDups();
|
||||
std::vector<TopoDS_Wire> sortedWires = ew.sortStrip(rw,true);
|
||||
outerWire = new TopoShapeWirePy(new TopoShape(*sortedWires.begin()));
|
||||
} else {
|
||||
Base::Console().Warning("ATDP::findShapeOutline: input is not planar graph. Wire detection not done\n");
|
||||
}
|
||||
}
|
||||
catch (Base::Exception &e) {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e.what());
|
||||
}
|
||||
if (!success) {
|
||||
return Py::None();
|
||||
}
|
||||
return Py::asObject(outerWire);
|
||||
}
|
||||
};
|
||||
|
||||
PyObject* initModule()
|
||||
|
|
|
@ -79,7 +79,10 @@ SET(Draw_SRCS
|
|||
DrawViewDraft.h
|
||||
DrawViewArch.cpp
|
||||
DrawViewArch.h
|
||||
)
|
||||
DrawViewMulti.cpp
|
||||
DrawViewMulti.h
|
||||
DrawViewImage.cpp
|
||||
DrawViewImage.h)
|
||||
|
||||
SET(TechDraw_SRCS
|
||||
AppTechDraw.cpp
|
||||
|
@ -90,6 +93,8 @@ SET(TechDraw_SRCS
|
|||
PreCompiled.h
|
||||
EdgeWalker.cpp
|
||||
EdgeWalker.h
|
||||
DrawProjectSplit.cpp
|
||||
DrawProjectSplit.h
|
||||
)
|
||||
|
||||
SET(Geometry_SRCS
|
||||
|
|
428
src/Mod/TechDraw/App/DrawProjectSplit.cpp
Normal file
428
src/Mod/TechDraw/App/DrawProjectSplit.cpp
Normal file
|
@ -0,0 +1,428 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) WandererFan (wandererfan@gmail.com) 2016 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepLProp_CurveTool.hxx>
|
||||
#include <BRepLProp_CLProps.hxx>
|
||||
#include <BRepExtrema_DistShapeShape.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <HLRBRep_Algo.hxx>
|
||||
#include <HLRAlgo_Projector.hxx>
|
||||
#include <HLRBRep_ShapeBounds.hxx>
|
||||
#include <HLRBRep_HLRToShape.hxx>
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <ShapeExtend_WireData.hxx>
|
||||
#include <ShapeFix_Wire.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <GeomLib_Tool.hxx>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "DrawProjectSplit.h"
|
||||
#include "DrawHatch.h"
|
||||
#include "EdgeWalker.h"
|
||||
|
||||
|
||||
//#include <Mod/TechDraw/App/DrawProjectSplitPy.h> // generated from DrawProjectSplitPy.xml
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace std;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// DrawProjectSplit
|
||||
//===========================================================================
|
||||
|
||||
DrawProjectSplit::DrawProjectSplit()
|
||||
{
|
||||
}
|
||||
|
||||
DrawProjectSplit::~DrawProjectSplit()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<TopoDS_Edge> DrawProjectSplit::getEdgesForWalker(TopoDS_Shape shape, double scale, Base::Vector3d direction)
|
||||
{
|
||||
std::vector<TopoDS_Edge> result;
|
||||
if (shape.IsNull()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_Copy BuilderCopy(shape);
|
||||
TopoDS_Shape copyShape = BuilderCopy.Shape();
|
||||
|
||||
gp_Pnt inputCenter(0,0,0);
|
||||
TopoDS_Shape scaledShape;
|
||||
scaledShape = TechDrawGeometry::scaleShape(copyShape,
|
||||
scale);
|
||||
TechDrawGeometry::GeometryObject* go = buildGeometryObject(scaledShape,inputCenter,direction);
|
||||
result = getEdges(go);
|
||||
|
||||
delete go;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
TechDrawGeometry::GeometryObject* DrawProjectSplit::buildGeometryObject(
|
||||
TopoDS_Shape shape,
|
||||
gp_Pnt& inputCenter,
|
||||
Base::Vector3d direction)
|
||||
{
|
||||
TechDrawGeometry::GeometryObject* geometryObject = new TechDrawGeometry::GeometryObject("DrawProjectSplit");
|
||||
|
||||
geometryObject->projectShape(shape,
|
||||
inputCenter,
|
||||
direction);
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecHARD, //always show the hard&outline visible lines
|
||||
true);
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
true);
|
||||
return geometryObject;
|
||||
}
|
||||
|
||||
//! get the projected edges with all their new intersections.
|
||||
std::vector<TopoDS_Edge> DrawProjectSplit::getEdges(TechDrawGeometry::GeometryObject* geometryObject)
|
||||
{
|
||||
const std::vector<TechDrawGeometry::BaseGeom*>& goEdges = geometryObject->getVisibleFaceEdges(true,true);
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::const_iterator itEdge = goEdges.begin();
|
||||
std::vector<TopoDS_Edge> origEdges;
|
||||
for (;itEdge != goEdges.end(); itEdge++) {
|
||||
origEdges.push_back((*itEdge)->occEdge);
|
||||
}
|
||||
|
||||
std::vector<TopoDS_Edge> faceEdges;
|
||||
std::vector<TopoDS_Edge> nonZero;
|
||||
for (auto& e:origEdges) { //drop any zero edges (shouldn't be any by now!!!)
|
||||
if (!DrawUtil::isZeroEdge(e)) {
|
||||
nonZero.push_back(e);
|
||||
} else {
|
||||
Base::Console().Message("INFO - DPS::extractFaces found ZeroEdge!\n");
|
||||
}
|
||||
}
|
||||
faceEdges = nonZero;
|
||||
origEdges = nonZero;
|
||||
|
||||
//HLR algo does not provide all edge intersections for edge endpoints.
|
||||
//need to split long edges touched by Vertex of another edge
|
||||
std::vector<splitPoint> splits;
|
||||
std::vector<TopoDS_Edge>::iterator itOuter = origEdges.begin();
|
||||
int iOuter = 0;
|
||||
for (; itOuter != origEdges.end(); itOuter++, iOuter++) {
|
||||
TopoDS_Vertex v1 = TopExp::FirstVertex((*itOuter));
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex((*itOuter));
|
||||
Bnd_Box sOuter;
|
||||
BRepBndLib::Add(*itOuter, sOuter);
|
||||
sOuter.SetGap(0.1);
|
||||
if (sOuter.IsVoid()) {
|
||||
Base::Console().Message("DPS::Extract Faces - outer Bnd_Box is void\n");
|
||||
continue;
|
||||
}
|
||||
if (DrawUtil::isZeroEdge(*itOuter)) {
|
||||
Base::Console().Message("DPS::extractFaces - outerEdge: %d is ZeroEdge\n",iOuter); //this is not finding ZeroEdges
|
||||
continue; //skip zero length edges. shouldn't happen ;)
|
||||
}
|
||||
int iInner = 0;
|
||||
std::vector<TopoDS_Edge>::iterator itInner = faceEdges.begin();
|
||||
for (; itInner != faceEdges.end(); itInner++,iInner++) {
|
||||
if (iInner == iOuter) {
|
||||
continue;
|
||||
}
|
||||
if (DrawUtil::isZeroEdge((*itInner))) {
|
||||
continue; //skip zero length edges. shouldn't happen ;)
|
||||
}
|
||||
|
||||
Bnd_Box sInner;
|
||||
BRepBndLib::Add(*itInner, sInner);
|
||||
sInner.SetGap(0.1);
|
||||
if (sInner.IsVoid()) {
|
||||
Base::Console().Log("INFO - DPS::Extract Faces - inner Bnd_Box is void\n");
|
||||
continue;
|
||||
}
|
||||
if (sOuter.IsOut(sInner)) { //bboxes of edges don't intersect, don't bother
|
||||
continue;
|
||||
}
|
||||
|
||||
double param = -1;
|
||||
if (isOnEdge((*itInner),v1,param,false)) {
|
||||
gp_Pnt pnt1 = BRep_Tool::Pnt(v1);
|
||||
splitPoint s1;
|
||||
s1.i = iInner;
|
||||
s1.v = Base::Vector3d(pnt1.X(),pnt1.Y(),pnt1.Z());
|
||||
s1.param = param;
|
||||
splits.push_back(s1);
|
||||
}
|
||||
if (isOnEdge((*itInner),v2,param,false)) {
|
||||
gp_Pnt pnt2 = BRep_Tool::Pnt(v2);
|
||||
splitPoint s2;
|
||||
s2.i = iInner;
|
||||
s2.v = Base::Vector3d(pnt2.X(),pnt2.Y(),pnt2.Z());
|
||||
s2.param = param;
|
||||
splits.push_back(s2);
|
||||
}
|
||||
} //inner loop
|
||||
} //outer loop
|
||||
|
||||
std::vector<splitPoint> sorted = sortSplits(splits,true);
|
||||
auto last = std::unique(sorted.begin(), sorted.end(), DrawProjectSplit::splitEqual); //duplicates to back
|
||||
sorted.erase(last, sorted.end()); //remove dupls
|
||||
std::vector<TopoDS_Edge> newEdges = splitEdges(faceEdges,sorted);
|
||||
|
||||
if (newEdges.empty()) {
|
||||
Base::Console().Log("LOG - DPS::extractFaces - no newEdges\n");
|
||||
}
|
||||
return newEdges;
|
||||
}
|
||||
|
||||
|
||||
double DrawProjectSplit::simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2)
|
||||
{
|
||||
Standard_Real minDist = -1;
|
||||
|
||||
BRepExtrema_DistShapeShape extss(s1, s2);
|
||||
if (!extss.IsDone()) {
|
||||
Base::Console().Message("FE - BRepExtrema_DistShapeShape failed");
|
||||
return -1;
|
||||
}
|
||||
int count = extss.NbSolution();
|
||||
if (count != 0) {
|
||||
minDist = extss.Value();
|
||||
} else {
|
||||
minDist = -1;
|
||||
}
|
||||
return minDist;
|
||||
}
|
||||
|
||||
|
||||
//this routine is the big time consumer. gets called many times (and is slow?))
|
||||
//note param gets modified here
|
||||
bool DrawProjectSplit::isOnEdge(TopoDS_Edge e, TopoDS_Vertex v, double& param, bool allowEnds)
|
||||
{
|
||||
bool result = false;
|
||||
bool outOfBox = false;
|
||||
param = -2;
|
||||
|
||||
//eliminate obvious cases
|
||||
Bnd_Box sBox;
|
||||
BRepBndLib::Add(e, sBox);
|
||||
sBox.SetGap(0.1);
|
||||
if (sBox.IsVoid()) {
|
||||
Base::Console().Message("DPS::isOnEdge - Bnd_Box is void\n");
|
||||
} else {
|
||||
gp_Pnt pt = BRep_Tool::Pnt(v);
|
||||
if (sBox.IsOut(pt)) {
|
||||
outOfBox = true;
|
||||
}
|
||||
}
|
||||
if (!outOfBox) {
|
||||
double dist = simpleMinDist(v,e);
|
||||
if (dist < 0.0) {
|
||||
Base::Console().Error("DPS::isOnEdge - simpleMinDist failed: %.3f\n",dist);
|
||||
result = false;
|
||||
} else if (dist < Precision::Confusion()) {
|
||||
const gp_Pnt pt = BRep_Tool::Pnt(v); //have to duplicate method 3 to get param
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
const Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
double maxDist = 0.000001; //magic number. less than this gives false positives.
|
||||
//bool found =
|
||||
(void) GeomLib_Tool::Parameter(c,pt,maxDist,param); //already know point it on curve
|
||||
result = true;
|
||||
}
|
||||
if (result) {
|
||||
TopoDS_Vertex v1 = TopExp::FirstVertex(e);
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex(e);
|
||||
if (DrawUtil::isSamePoint(v,v1) || DrawUtil::isSamePoint(v,v2)) {
|
||||
if (!allowEnds) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //!outofbox
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::vector<TopoDS_Edge> DrawProjectSplit::splitEdges(std::vector<TopoDS_Edge> edges, std::vector<splitPoint> splits)
|
||||
{
|
||||
std::vector<TopoDS_Edge> result;
|
||||
std::vector<TopoDS_Edge> newEdges;
|
||||
std::vector<splitPoint> edgeSplits; //splits for current edge
|
||||
int iEdge = 0; //current edge index
|
||||
int iSplit = 0; //current splitindex
|
||||
int ii = 0; //i value of current split
|
||||
int endEdge = edges.size();
|
||||
int endSplit = splits.size();
|
||||
int imax = std::numeric_limits<int>::max();
|
||||
|
||||
while ((iEdge < endEdge) ) {
|
||||
if (iSplit < endSplit) {
|
||||
ii = splits[iSplit].i;
|
||||
} else {
|
||||
ii = imax;
|
||||
}
|
||||
if (ii == iEdge) {
|
||||
edgeSplits.push_back(splits[iSplit]);
|
||||
iSplit++;
|
||||
} else if (ii > iEdge) {
|
||||
if (!edgeSplits.empty()) { //save *iedge's splits
|
||||
newEdges = split1Edge(edges[iEdge],edgeSplits);
|
||||
result.insert(result.end(), newEdges.begin(), newEdges.end());
|
||||
edgeSplits.clear();
|
||||
} else {
|
||||
result.push_back(edges[iEdge]); //save *iedge
|
||||
}
|
||||
iEdge++; //next edge
|
||||
} else if (iEdge > ii) {
|
||||
iSplit++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!edgeSplits.empty()) { //handle last batch
|
||||
newEdges = split1Edge(edges[iEdge],edgeSplits);
|
||||
result.insert(result.end(), newEdges.begin(), newEdges.end());
|
||||
edgeSplits.clear();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::vector<TopoDS_Edge> DrawProjectSplit::split1Edge(TopoDS_Edge e, std::vector<splitPoint> splits)
|
||||
{
|
||||
std::vector<TopoDS_Edge> result;
|
||||
if (splits.empty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
double first = BRepLProp_CurveTool::FirstParameter(adapt);
|
||||
double last = BRepLProp_CurveTool::LastParameter(adapt);
|
||||
if (first > last) {
|
||||
//TODO parms.reverse();
|
||||
Base::Console().Message("DPS::split1Edge - edge is backwards!\n");
|
||||
return result;
|
||||
}
|
||||
std::vector<double> parms;
|
||||
parms.push_back(first);
|
||||
for (auto& s:splits) {
|
||||
parms.push_back(s.param);
|
||||
}
|
||||
|
||||
parms.push_back(last);
|
||||
std::vector<double>::iterator pfirst = parms.begin();
|
||||
auto parms2 = parms.begin() + 1;
|
||||
std::vector<double>::iterator psecond = parms2;
|
||||
std::vector<double>::iterator pstop = parms.end();
|
||||
for (; psecond != pstop; pfirst++,psecond++) {
|
||||
try {
|
||||
BRepBuilderAPI_MakeEdge mkEdge(c, *pfirst, *psecond);
|
||||
if (mkEdge.IsDone()) {
|
||||
TopoDS_Edge e1 = mkEdge.Edge();
|
||||
result.push_back(e1);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Base::Console().Message("LOG - DPS::split1Edge failed building edge segment\n");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<splitPoint> DrawProjectSplit::sortSplits(std::vector<splitPoint>& s, bool ascend)
|
||||
{
|
||||
std::vector<splitPoint> sorted = s;
|
||||
std::sort(sorted.begin(), sorted.end(), DrawProjectSplit::splitCompare);
|
||||
if (ascend) {
|
||||
std::reverse(sorted.begin(),sorted.end());
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
|
||||
//return true if p1 "is greater than" p2
|
||||
/*static*/bool DrawProjectSplit::splitCompare(const splitPoint& p1, const splitPoint& p2)
|
||||
{
|
||||
bool result = false;
|
||||
if (p1.i > p2.i) {
|
||||
result = true;
|
||||
} else if (p1.i < p2.i) {
|
||||
result = false;
|
||||
} else if (p1.param > p2.param) {
|
||||
result = true;
|
||||
} else if (p1.param < p2.param) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//return true if p1 "is equal to" p2
|
||||
/*static*/bool DrawProjectSplit::splitEqual(const splitPoint& p1, const splitPoint& p2)
|
||||
{
|
||||
bool result = false;
|
||||
if ((p1.i == p2.i) &&
|
||||
(fabs(p1.param - p2.param) < Precision::Confusion())) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
86
src/Mod/TechDraw/App/DrawProjectSplit.h
Normal file
86
src/Mod/TechDraw/App/DrawProjectSplit.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) WandererFan (wandererfan@gmail.com) 2016 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _DrawProjectSplit_h_
|
||||
#define _DrawProjectSplit_h_
|
||||
|
||||
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <App/FeaturePython.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Base/BoundBox.h>
|
||||
|
||||
class gp_Pnt;
|
||||
|
||||
namespace TechDrawGeometry
|
||||
{
|
||||
class GeometryObject;
|
||||
class Vertex;
|
||||
class BaseGeom;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
struct splitPoint {
|
||||
int i;
|
||||
Base::Vector3d v;
|
||||
double param;
|
||||
};
|
||||
|
||||
class TechDrawExport DrawProjectSplit
|
||||
{
|
||||
public:
|
||||
DrawProjectSplit();
|
||||
~DrawProjectSplit();
|
||||
|
||||
public:
|
||||
static std::vector<TopoDS_Edge> getEdgesForWalker(TopoDS_Shape shape, double scale, Base::Vector3d direction);
|
||||
static TechDrawGeometry::GeometryObject* buildGeometryObject(TopoDS_Shape shape, gp_Pnt& center, Base::Vector3d direction);
|
||||
|
||||
static bool isOnEdge(TopoDS_Edge e, TopoDS_Vertex v, double& param, bool allowEnds = false);
|
||||
static std::vector<TopoDS_Edge> splitEdges(std::vector<TopoDS_Edge> orig, std::vector<splitPoint> splits);
|
||||
static std::vector<TopoDS_Edge> split1Edge(TopoDS_Edge e, std::vector<splitPoint> splitPoints);
|
||||
static double simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2); //const; //probably sb static or DrawUtil
|
||||
|
||||
static std::vector<splitPoint> sortSplits(std::vector<splitPoint>& s, bool ascend);
|
||||
static bool splitCompare(const splitPoint& p1, const splitPoint& p2);
|
||||
static bool splitEqual(const splitPoint& p1, const splitPoint& p2);
|
||||
|
||||
protected:
|
||||
static std::vector<TopoDS_Edge> getEdges(TechDrawGeometry::GeometryObject* geometryObject);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawProjectSplit> DrawProjectSplitPython;
|
||||
|
||||
} //namespace TechDraw
|
||||
|
||||
#endif // #ifndef _DrawProjectSplit_h_
|
|
@ -118,7 +118,6 @@ void DrawViewCollection::rebuildViewList()
|
|||
|
||||
short DrawViewCollection::mustExecute() const
|
||||
{
|
||||
// If Tolerance Property is touched
|
||||
if (Views.isTouched() ||
|
||||
Source.isTouched()) {
|
||||
return 1;
|
||||
|
|
|
@ -140,7 +140,7 @@ void DrawViewDimension::onChanged(const App::Property* prop)
|
|||
// MeasureType.getValue(),measurement->has3DReferences(),has3DReferences());
|
||||
clear3DMeasurements(); //Measurement object
|
||||
if (!(References3D.getValues()).empty()) {
|
||||
set3DMeasurement(References3D.getValues().at(0),References3D.getSubValues()); //Measurement object
|
||||
setAll3DMeasurement();
|
||||
} else {
|
||||
if (MeasureType.isValue("True")) { //empty 3dRefs, but True
|
||||
MeasureType.touch(); //run MeasureType logic for this case
|
||||
|
@ -156,8 +156,7 @@ void DrawViewDimension::onChanged(const App::Property* prop)
|
|||
void DrawViewDimension::onDocumentRestored()
|
||||
{
|
||||
if (has3DReferences()) {
|
||||
clear3DMeasurements();
|
||||
set3DMeasurement(References3D.getValues().at(0),References3D.getSubValues());
|
||||
setAll3DMeasurement();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +253,7 @@ double DrawViewDimension::getDimValue() const
|
|||
if (!measurement->has3DReferences()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if(Type.isValue("Distance")) {
|
||||
result = measurement->delta().Length();
|
||||
} else if(Type.isValue("DistanceX")){
|
||||
|
@ -486,14 +486,17 @@ int DrawViewDimension::getRefType2(const std::string g1, const std::string g2)
|
|||
return refType;
|
||||
}
|
||||
|
||||
//!add 1 3D measurement Reference
|
||||
void DrawViewDimension::set3DMeasurement(DocumentObject* const &obj, const std::vector<std::string>& subElements)
|
||||
//!add Dimension 3D references to measurement
|
||||
void DrawViewDimension::setAll3DMeasurement()
|
||||
{
|
||||
std::vector<std::string>::const_iterator itSub = subElements.begin();
|
||||
for (; itSub != subElements.end(); itSub++) {
|
||||
//int rc =
|
||||
static_cast<void> (measurement->addReference3D(obj,(*itSub).c_str()));
|
||||
}
|
||||
measurement->clear();
|
||||
const std::vector<App::DocumentObject*> &Objs = References3D.getValues();
|
||||
const std::vector<std::string> &Subs = References3D.getSubValues();
|
||||
int end = Objs.size();
|
||||
int i = 0;
|
||||
for ( ; i < end; i++) {
|
||||
static_cast<void> (measurement->addReference3D(Objs.at(i), Subs.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
//delete all previous measurements
|
||||
|
|
|
@ -35,6 +35,12 @@ class Measurement;
|
|||
}
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawViewPart;
|
||||
|
||||
struct DimRef {
|
||||
DrawViewPart* part;
|
||||
std::string sub;
|
||||
};
|
||||
|
||||
class DrawViewPart;
|
||||
|
||||
|
@ -86,6 +92,8 @@ public:
|
|||
static int getRefType1(const std::string s);
|
||||
static int getRefType2(const std::string s1, const std::string s2);
|
||||
int getRefType() const; //Vertex-Vertex, Edge, Edge-Edge
|
||||
void setAll3DMeasurement();
|
||||
void clear3DMeasurements(void);
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
@ -95,8 +103,6 @@ protected:
|
|||
|
||||
protected:
|
||||
Measure::Measurement *measurement;
|
||||
void set3DMeasurement(DocumentObject* const &obj, const std::vector<std::string>& subElements);
|
||||
void clear3DMeasurements(void);
|
||||
double dist2Segs(Base::Vector2D s1,
|
||||
Base::Vector2D e1,
|
||||
Base::Vector2D s2,
|
||||
|
|
98
src/Mod/TechDraw/App/DrawViewImage.cpp
Normal file
98
src/Mod/TechDraw/App/DrawViewImage.cpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
#include <iterator>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "DrawViewImage.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace std;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// DrawViewImage
|
||||
//===========================================================================
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewImage, TechDraw::DrawView)
|
||||
|
||||
|
||||
DrawViewImage::DrawViewImage(void)
|
||||
{
|
||||
static const char *vgroup = "Image";
|
||||
|
||||
ADD_PROPERTY_TYPE(ImageFile,(""),vgroup,App::Prop_None,"The file containing this bitmap");
|
||||
ADD_PROPERTY_TYPE(Width ,(100),vgroup,App::Prop_None,"The width of the image view");
|
||||
ADD_PROPERTY_TYPE(Height ,(100),vgroup,App::Prop_None,"The height of the view");
|
||||
ScaleType.setValue("Custom");
|
||||
}
|
||||
|
||||
DrawViewImage::~DrawViewImage()
|
||||
{
|
||||
}
|
||||
|
||||
void DrawViewImage::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &ImageFile) {
|
||||
if (!isRestoring()) {
|
||||
}
|
||||
}
|
||||
TechDraw::DrawView::onChanged(prop);
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawViewImage::execute(void)
|
||||
{
|
||||
return DrawView::execute();
|
||||
}
|
||||
|
||||
QRectF DrawViewImage::getRect() const
|
||||
{
|
||||
QRectF result(0.0,0.0,Width.getValue(),Height.getValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawViewImagePython, TechDraw::DrawViewImage)
|
||||
template<> const char* TechDraw::DrawViewImagePython::getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderImage";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewImage>;
|
||||
}
|
74
src/Mod/TechDraw/App/DrawViewImage.h
Normal file
74
src/Mod/TechDraw/App/DrawViewImage.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _DrawViewImage_h_
|
||||
#define _DrawViewImage_h_
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include <App/PropertyFile.h>
|
||||
#include "DrawView.h"
|
||||
#include <App/FeaturePython.h>
|
||||
|
||||
#include <Base/BoundBox.h>
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
|
||||
class TechDrawExport DrawViewImage : public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawViewImage);
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
DrawViewImage(void);
|
||||
virtual ~DrawViewImage();
|
||||
|
||||
App::PropertyFile ImageFile;
|
||||
App::PropertyFloat Width;
|
||||
App::PropertyFloat Height;
|
||||
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
//@}
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderImage";
|
||||
}
|
||||
virtual QRectF getRect() const;
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
Base::BoundBox3d bbox;
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawViewImage> DrawViewImagePython;
|
||||
|
||||
|
||||
} //namespace TechDraw
|
||||
|
||||
|
||||
#endif
|
176
src/Mod/TechDraw/App/DrawViewMulti.cpp
Normal file
176
src/Mod/TechDraw/App/DrawViewMulti.cpp
Normal file
|
@ -0,0 +1,176 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) WandererFan (wandererfan@gmail.com) 2016 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <BRep_Builder.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
|
||||
# include <QFile>
|
||||
# include <QFileInfo>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "DrawViewMulti.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace std;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// DrawViewMulti
|
||||
//===========================================================================
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewMulti, TechDraw::DrawViewPart)
|
||||
|
||||
DrawViewMulti::DrawViewMulti()
|
||||
{
|
||||
static const char *group = "Projection";
|
||||
|
||||
//properties that affect Geometry
|
||||
ADD_PROPERTY_TYPE(Sources ,(0),group,App::Prop_None,"3D Shapes to view");
|
||||
|
||||
//Source is replaced by Sources in Multi
|
||||
Source.setStatus(App::Property::ReadOnly,true);
|
||||
|
||||
geometryObject = nullptr;
|
||||
}
|
||||
|
||||
DrawViewMulti::~DrawViewMulti()
|
||||
{
|
||||
}
|
||||
|
||||
short DrawViewMulti::mustExecute() const
|
||||
{
|
||||
short result = 0;
|
||||
if (!isRestoring()) {
|
||||
result = (Sources.isTouched());
|
||||
}
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
return TechDraw::DrawViewPart::mustExecute();
|
||||
}
|
||||
|
||||
void DrawViewMulti::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
//Base::Console().Message("TRACE - DVM::onChanged(%s) - %s\n",prop->getName(),Label.getValue());
|
||||
if (prop == &Sources) {
|
||||
const std::vector<App::DocumentObject*>& links = Sources.getValues();
|
||||
if (!links.empty()) {
|
||||
Source.setValue(links.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DrawViewPart::onChanged(prop);
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawViewMulti::execute(void)
|
||||
{
|
||||
const std::vector<App::DocumentObject*>& links = Sources.getValues();
|
||||
if (links.empty()) {
|
||||
Base::Console().Log("INFO - DVM::execute - No Sources - creation?\n");
|
||||
return DrawViewPart::execute();
|
||||
}
|
||||
|
||||
//Base::Console().Message("TRACE - DVM::execute() - %s/%s\n",getNameInDocument(),Label.getValue());
|
||||
|
||||
(void) DrawView::execute(); //make sure Scale is up to date
|
||||
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound comp;
|
||||
builder.MakeCompound(comp);
|
||||
for (auto& l:links) {
|
||||
const Part::TopoShape &partTopo = static_cast<Part::Feature*>(l)->Shape.getShape();
|
||||
BRepBuilderAPI_Copy BuilderCopy(partTopo.getShape());
|
||||
TopoDS_Shape shape = BuilderCopy.Shape();
|
||||
builder.Add(comp, shape);
|
||||
}
|
||||
m_compound = comp;
|
||||
|
||||
gp_Pnt inputCenter;
|
||||
try {
|
||||
inputCenter = TechDrawGeometry::findCentroid(comp,
|
||||
Direction.getValue());
|
||||
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(comp,
|
||||
inputCenter,
|
||||
Scale.getValue());
|
||||
geometryObject = buildGeometryObject(mirroredShape,inputCenter);
|
||||
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
extractFaces();
|
||||
#endif //#if MOD_TECHDRAW_HANDLE_FACES
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e1 = Standard_Failure::Caught();
|
||||
Base::Console().Log("LOG - DVM::execute - projection failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString());
|
||||
return new App::DocumentObjectExecReturn(e1->GetMessageString());
|
||||
}
|
||||
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawViewMultiPython, TechDraw::DrawViewMulti)
|
||||
template<> const char* TechDraw::DrawViewMultiPython::getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderViewProviderViewPart";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewMulti>;
|
||||
}
|
85
src/Mod/TechDraw/App/DrawViewMulti.h
Normal file
85
src/Mod/TechDraw/App/DrawViewMulti.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2007 *
|
||||
* Copyright (c) Luke Parry (l.parry@warwick.ac.uk) 2013 *
|
||||
* Copyright (c) WandererFan (wandererfan@gmail.com) 2016 *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _DrawViewMulti_h_
|
||||
#define _DrawViewMulti_h_
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include <App/PropertyFile.h>
|
||||
#include <App/FeaturePython.h>
|
||||
#include <App/Material.h>
|
||||
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include "DrawViewPart.h"
|
||||
|
||||
class gp_Pln;
|
||||
class TopoDS_Face;
|
||||
|
||||
namespace TechDrawGeometry
|
||||
{
|
||||
//class Face;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
|
||||
/** Base class of all View Features in the drawing module
|
||||
*/
|
||||
class TechDrawExport DrawViewMulti : public DrawViewPart
|
||||
{
|
||||
PROPERTY_HEADER(Part::DrawViewMulti);
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
DrawViewMulti(void);
|
||||
virtual ~DrawViewMulti();
|
||||
|
||||
App::PropertyLinkList Sources;
|
||||
|
||||
virtual short mustExecute() 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::ViewProviderViewPart";
|
||||
}
|
||||
|
||||
protected:
|
||||
TopoDS_Compound m_compound;
|
||||
|
||||
// void getParameters(void);
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawViewMulti> DrawViewMultiPython;
|
||||
|
||||
} //namespace TechDraw
|
||||
|
||||
#endif
|
|
@ -95,7 +95,6 @@ using namespace std;
|
|||
// DrawViewPart
|
||||
//===========================================================================
|
||||
|
||||
App::PropertyFloatConstraint::Constraints DrawViewPart::floatRange = {0.01f,5.0f,0.05f};
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewPart, TechDraw::DrawView)
|
||||
|
||||
|
@ -108,17 +107,13 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
|
|||
//properties that affect Geometry
|
||||
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"3D Shape to view");
|
||||
ADD_PROPERTY_TYPE(Direction ,(0,0,1.0) ,group,App::Prop_None,"Projection direction. The direction you are looking from.");
|
||||
// ADD_PROPERTY_TYPE(XAxisDirection ,(1,0,0) ,group,App::Prop_None,"Where to place projection's XAxis (rotation)");
|
||||
ADD_PROPERTY_TYPE(Tolerance,(0.05f),group,App::Prop_None,"Internal tolerance for calculations");
|
||||
Tolerance.setConstraints(&floatRange);
|
||||
|
||||
//properties that affect Appearance
|
||||
//visible outline
|
||||
ADD_PROPERTY_TYPE(SmoothVisible ,(false),sgroup,App::Prop_None,"Visible Smooth lines on/off");
|
||||
ADD_PROPERTY_TYPE(SeamVisible ,(false),sgroup,App::Prop_None,"Visible Seam lines on/off");
|
||||
ADD_PROPERTY_TYPE(IsoVisible ,(false),sgroup,App::Prop_None,"Visible Iso u,v lines on/off");
|
||||
ADD_PROPERTY_TYPE(HardHidden ,(false),sgroup,App::Prop_None,"Hidden Hard lines on/off"); // and outline
|
||||
//hidden outline
|
||||
ADD_PROPERTY_TYPE(HardHidden ,(false),sgroup,App::Prop_None,"Hidden Hard lines on/off");
|
||||
ADD_PROPERTY_TYPE(SmoothHidden ,(false),sgroup,App::Prop_None,"Hidden Smooth lines on/off");
|
||||
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");
|
||||
|
@ -135,7 +130,7 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
|
|||
//properties that affect Section Line
|
||||
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup,App::Prop_None,"Show/hide section line if applicable");
|
||||
|
||||
geometryObject = new TechDrawGeometry::GeometryObject(this);
|
||||
geometryObject = nullptr;
|
||||
getRunControl();
|
||||
|
||||
}
|
||||
|
@ -162,47 +157,20 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
|||
return new App::DocumentObjectExecReturn("FVP - Linked shape object is empty");
|
||||
}
|
||||
|
||||
//Base::Console().Message("TRACE - DVP::execute - %s/%s ScaleType: %s\n",getNameInDocument(),Label.getValue(),ScaleType.getValueAsString());
|
||||
|
||||
(void) DrawView::execute(); //make sure Scale is up to date
|
||||
|
||||
geometryObject->setTolerance(Tolerance.getValue());
|
||||
geometryObject->setScale(Scale.getValue());
|
||||
|
||||
//TODO: remove these try/catch block when code is stable
|
||||
gp_Pnt inputCenter;
|
||||
try {
|
||||
inputCenter = TechDrawGeometry::findCentroid(shape,
|
||||
Direction.getValue());
|
||||
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e1 = Standard_Failure::Caught();
|
||||
Base::Console().Log("LOG - DVP::execute - findCentroid failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString());
|
||||
return new App::DocumentObjectExecReturn(e1->GetMessageString());
|
||||
}
|
||||
inputCenter = TechDrawGeometry::findCentroid(shape,
|
||||
Direction.getValue());
|
||||
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
|
||||
|
||||
TopoDS_Shape mirroredShape;
|
||||
try {
|
||||
mirroredShape = TechDrawGeometry::mirrorShape(shape,
|
||||
inputCenter,
|
||||
Scale.getValue());
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e2 = Standard_Failure::Caught();
|
||||
Base::Console().Log("LOG - DVP::execute - mirrorShape failed for %s - %s **\n",getNameInDocument(),e2->GetMessageString());
|
||||
return new App::DocumentObjectExecReturn(e2->GetMessageString());
|
||||
}
|
||||
mirroredShape = TechDrawGeometry::mirrorShape(shape,
|
||||
inputCenter,
|
||||
Scale.getValue());
|
||||
|
||||
try {
|
||||
geometryObject->setIsoCount(IsoCount.getValue());
|
||||
buildGeometryObject(mirroredShape,inputCenter);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e3 = Standard_Failure::Caught();
|
||||
Base::Console().Log("LOG - DVP::execute - buildGeometryObject failed for %s - %s **\n",getNameInDocument(),e3->GetMessageString());
|
||||
return new App::DocumentObjectExecReturn(e3->GetMessageString());
|
||||
}
|
||||
geometryObject = buildGeometryObject(mirroredShape,inputCenter);
|
||||
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
if (handleFaces()) {
|
||||
|
@ -238,64 +206,68 @@ short DrawViewPart::mustExecute() const
|
|||
|
||||
void DrawViewPart::onChanged(const App::Property* prop)
|
||||
{
|
||||
//Base::Console().Message("TRACE - DVP::onChanged(%s) - %s\n",prop->getName(),Label.getValue());
|
||||
|
||||
DrawView::onChanged(prop);
|
||||
|
||||
//TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.
|
||||
}
|
||||
|
||||
void DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Pnt& inputCenter)
|
||||
//note: slightly different than routine with same name in DrawProjectSplit
|
||||
TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Pnt& inputCenter)
|
||||
{
|
||||
Base::Vector3d baseProjDir = Direction.getValue();
|
||||
TechDrawGeometry::GeometryObject* go = new TechDrawGeometry::GeometryObject(getNameInDocument());
|
||||
go->setIsoCount(IsoCount.getValue());
|
||||
|
||||
Base::Vector3d baseProjDir = Direction.getValue();
|
||||
saveParamSpace(baseProjDir);
|
||||
|
||||
geometryObject->projectShape(shape,
|
||||
inputCenter,
|
||||
Direction.getValue());
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecHARD, //always show the hard&outline visible lines
|
||||
true);
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
true);
|
||||
go->projectShape(shape,
|
||||
inputCenter,
|
||||
Direction.getValue());
|
||||
go->extractGeometry(TechDrawGeometry::ecHARD, //always show the hard&outline visible lines
|
||||
true);
|
||||
go->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
true);
|
||||
if (SmoothVisible.getValue()) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
true);
|
||||
go->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
true);
|
||||
}
|
||||
if (SeamVisible.getValue()) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
true);
|
||||
go->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
true);
|
||||
}
|
||||
if ((IsoVisible.getValue()) && (IsoCount.getValue() > 0)) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
true);
|
||||
go->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
true);
|
||||
}
|
||||
if (HardHidden.getValue()) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecHARD,
|
||||
false);
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecHARD,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
false);
|
||||
}
|
||||
if (SmoothHidden.getValue()) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
false);
|
||||
}
|
||||
if (SeamHidden.getValue()) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
false);
|
||||
}
|
||||
if (IsoHidden.getValue() && (IsoCount.getValue() > 0)) {
|
||||
geometryObject->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
false);
|
||||
}
|
||||
bbox = geometryObject->calcBoundingBox();
|
||||
bbox = go->calcBoundingBox();
|
||||
return go;
|
||||
}
|
||||
|
||||
//! make faces from the existing edge geometry
|
||||
void DrawViewPart::extractFaces()
|
||||
{
|
||||
geometryObject->clearFaceGeom();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*>& goEdges = geometryObject->getVisibleFaceEdges();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*>& goEdges =
|
||||
geometryObject->getVisibleFaceEdges(SmoothVisible.getValue(),SeamVisible.getValue());
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::const_iterator itEdge = goEdges.begin();
|
||||
std::vector<TopoDS_Edge> origEdges;
|
||||
for (;itEdge != goEdges.end(); itEdge++) {
|
||||
|
@ -356,7 +328,7 @@ void DrawViewPart::extractFaces()
|
|||
}
|
||||
|
||||
double param = -1;
|
||||
if (isOnEdge((*itInner),v1,param,false)) {
|
||||
if (DrawProjectSplit::isOnEdge((*itInner),v1,param,false)) {
|
||||
gp_Pnt pnt1 = BRep_Tool::Pnt(v1);
|
||||
splitPoint s1;
|
||||
s1.i = iInner;
|
||||
|
@ -364,7 +336,7 @@ void DrawViewPart::extractFaces()
|
|||
s1.param = param;
|
||||
splits.push_back(s1);
|
||||
}
|
||||
if (isOnEdge((*itInner),v2,param,false)) {
|
||||
if (DrawProjectSplit::isOnEdge((*itInner),v2,param,false)) {
|
||||
gp_Pnt pnt2 = BRep_Tool::Pnt(v2);
|
||||
splitPoint s2;
|
||||
s2.i = iInner;
|
||||
|
@ -375,10 +347,10 @@ void DrawViewPart::extractFaces()
|
|||
} //inner loop
|
||||
} //outer loop
|
||||
|
||||
std::vector<splitPoint> sorted = sortSplits(splits,true);
|
||||
auto last = std::unique(sorted.begin(), sorted.end(), DrawViewPart::splitEqual); //duplicates to back
|
||||
std::vector<splitPoint> sorted = DrawProjectSplit::sortSplits(splits,true);
|
||||
auto last = std::unique(sorted.begin(), sorted.end(), DrawProjectSplit::splitEqual); //duplicates to back
|
||||
sorted.erase(last, sorted.end()); //remove dupls
|
||||
std::vector<TopoDS_Edge> newEdges = splitEdges(faceEdges,sorted);
|
||||
std::vector<TopoDS_Edge> newEdges = DrawProjectSplit::splitEdges(faceEdges,sorted);
|
||||
|
||||
if (newEdges.empty()) {
|
||||
Base::Console().Log("LOG - DVP::extractFaces - no newEdges\n");
|
||||
|
@ -408,247 +380,6 @@ void DrawViewPart::extractFaces()
|
|||
}
|
||||
}
|
||||
|
||||
double DrawViewPart::simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2)
|
||||
{
|
||||
Standard_Real minDist = -1;
|
||||
|
||||
BRepExtrema_DistShapeShape extss(s1, s2);
|
||||
if (!extss.IsDone()) {
|
||||
Base::Console().Message("DVP - BRepExtrema_DistShapeShape failed");
|
||||
return -1;
|
||||
}
|
||||
int count = extss.NbSolution();
|
||||
if (count != 0) {
|
||||
minDist = extss.Value();
|
||||
} else {
|
||||
minDist = -1;
|
||||
}
|
||||
return minDist;
|
||||
}
|
||||
|
||||
//this routine is the big time consumer. gets called many times (and is slow?))
|
||||
//note param gets modified here
|
||||
bool DrawViewPart::isOnEdge(TopoDS_Edge e, TopoDS_Vertex v, double& param, bool allowEnds)
|
||||
{
|
||||
bool result = false;
|
||||
bool outOfBox = false;
|
||||
param = -2;
|
||||
|
||||
//eliminate obvious cases
|
||||
Bnd_Box sBox;
|
||||
BRepBndLib::Add(e, sBox);
|
||||
sBox.SetGap(0.1);
|
||||
if (sBox.IsVoid()) {
|
||||
Base::Console().Message("DVP::isOnEdge - Bnd_Box is void for %s\n",getNameInDocument());
|
||||
} else {
|
||||
gp_Pnt pt = BRep_Tool::Pnt(v);
|
||||
if (sBox.IsOut(pt)) {
|
||||
outOfBox = true;
|
||||
}
|
||||
}
|
||||
if (!outOfBox) {
|
||||
if (m_interAlgo == 1) {
|
||||
//1) using projPointOnCurve. roughly similar to dist to shape w/ bndbox. hangs(?) w/o bndbox
|
||||
try {
|
||||
gp_Pnt pt = BRep_Tool::Pnt(v);
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
GeomAPI_ProjectPointOnCurve proj(pt,c);
|
||||
int n = proj.NbPoints();
|
||||
if (n > 0) {
|
||||
if (proj.LowerDistance() < Precision::Confusion()) {
|
||||
param = proj.LowerDistanceParameter();
|
||||
result = true;
|
||||
}
|
||||
if (result) {
|
||||
TopoDS_Vertex v1 = TopExp::FirstVertex(e);
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex(e);
|
||||
if (DrawUtil::isSamePoint(v,v1) || DrawUtil::isSamePoint(v,v2)) {
|
||||
if (!allowEnds) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught(); //no perp projection
|
||||
}
|
||||
} else if (m_interAlgo == 2) { //can't provide param as is
|
||||
double dist = simpleMinDist(v,e);
|
||||
if (dist < 0.0) {
|
||||
Base::Console().Error("DVP::isOnEdge - simpleMinDist failed: %.3f\n",dist);
|
||||
result = false;
|
||||
} else if (dist < Precision::Confusion()) {
|
||||
const gp_Pnt pt = BRep_Tool::Pnt(v); //have to duplicate method 3 to get param
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
const Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
double maxDist = 0.000001; //magic number. less than this gives false positives.
|
||||
//bool found =
|
||||
(void) GeomLib_Tool::Parameter(c,pt,maxDist,param); //already know point it on curve
|
||||
result = true;
|
||||
}
|
||||
if (result) {
|
||||
TopoDS_Vertex v1 = TopExp::FirstVertex(e);
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex(e);
|
||||
if (DrawUtil::isSamePoint(v,v1) || DrawUtil::isSamePoint(v,v2)) {
|
||||
if (!allowEnds) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (m_interAlgo == 3) {
|
||||
const gp_Pnt pt = BRep_Tool::Pnt(v);
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
const Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
double par = -1;
|
||||
double maxDist = 0.000001; //magic number. less than this gives false positives.
|
||||
bool found = GeomLib_Tool::Parameter(c,pt,maxDist,par);
|
||||
if (found) {
|
||||
result = true;
|
||||
param = par;
|
||||
TopoDS_Vertex v1 = TopExp::FirstVertex(e);
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex(e);
|
||||
if (DrawUtil::isSamePoint(v,v1) || DrawUtil::isSamePoint(v,v2)) {
|
||||
if (!allowEnds) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //!outofbox
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<TopoDS_Edge> DrawViewPart::splitEdges(std::vector<TopoDS_Edge> edges, std::vector<splitPoint> splits)
|
||||
{
|
||||
std::vector<TopoDS_Edge> result;
|
||||
std::vector<TopoDS_Edge> newEdges;
|
||||
std::vector<splitPoint> edgeSplits; //splits for current edge
|
||||
int iEdge = 0; //current edge index
|
||||
int iSplit = 0; //current splitindex
|
||||
int ii = 0; //i value of current split
|
||||
int endEdge = edges.size();
|
||||
int endSplit = splits.size();
|
||||
int imax = std::numeric_limits<int>::max();
|
||||
|
||||
while ((iEdge < endEdge) ) {
|
||||
if (iSplit < endSplit) {
|
||||
ii = splits[iSplit].i;
|
||||
} else {
|
||||
ii = imax;
|
||||
}
|
||||
if (ii == iEdge) {
|
||||
edgeSplits.push_back(splits[iSplit]);
|
||||
iSplit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ii > iEdge) {
|
||||
if (!edgeSplits.empty()) { //save *iedge's splits
|
||||
newEdges = split1Edge(edges[iEdge],edgeSplits);
|
||||
result.insert(result.end(), newEdges.begin(), newEdges.end());
|
||||
edgeSplits.clear();
|
||||
} else {
|
||||
result.push_back(edges[iEdge]); //save *iedge
|
||||
}
|
||||
iEdge++; //next edge
|
||||
continue;
|
||||
}
|
||||
|
||||
if (iEdge > ii) {
|
||||
iSplit++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!edgeSplits.empty()) { //handle last batch
|
||||
newEdges = split1Edge(edges[iEdge],edgeSplits);
|
||||
result.insert(result.end(), newEdges.begin(), newEdges.end());
|
||||
edgeSplits.clear();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<TopoDS_Edge> DrawViewPart::split1Edge(TopoDS_Edge e, std::vector<splitPoint> splits)
|
||||
{
|
||||
//Base::Console().Message("DVP::split1Edge - splits: %d\n",splits.size());
|
||||
std::vector<TopoDS_Edge> result;
|
||||
if (splits.empty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
BRepAdaptor_Curve adapt(e);
|
||||
Handle_Geom_Curve c = adapt.Curve().Curve();
|
||||
double first = BRepLProp_CurveTool::FirstParameter(adapt);
|
||||
double last = BRepLProp_CurveTool::LastParameter(adapt);
|
||||
if (first > last) {
|
||||
//TODO parms.reverse();
|
||||
Base::Console().Message("DVP::split1Edge - edge is backwards!\n");
|
||||
return result;
|
||||
}
|
||||
std::vector<double> parms;
|
||||
parms.push_back(first);
|
||||
for (auto& s:splits) {
|
||||
parms.push_back(s.param);
|
||||
}
|
||||
|
||||
parms.push_back(last);
|
||||
std::vector<double>::iterator pfirst = parms.begin();
|
||||
auto parms2 = parms.begin() + 1;
|
||||
std::vector<double>::iterator psecond = parms2;
|
||||
std::vector<double>::iterator pstop = parms.end();
|
||||
for (; psecond != pstop; pfirst++,psecond++) {
|
||||
try {
|
||||
BRepBuilderAPI_MakeEdge mkEdge(c, *pfirst, *psecond);
|
||||
if (mkEdge.IsDone()) {
|
||||
TopoDS_Edge e1 = mkEdge.Edge();
|
||||
result.push_back(e1);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Base::Console().Message("LOG - DVP::split1Edge failed building edge segment\n");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<splitPoint> DrawViewPart::sortSplits(std::vector<splitPoint>& s, bool ascend)
|
||||
{
|
||||
std::vector<splitPoint> sorted = s;
|
||||
std::sort(sorted.begin(), sorted.end(), DrawViewPart::splitCompare);
|
||||
if (ascend) {
|
||||
std::reverse(sorted.begin(),sorted.end());
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
|
||||
//return true if p1 "is greater than" p2
|
||||
/*static*/bool DrawViewPart::splitCompare(const splitPoint& p1, const splitPoint& p2)
|
||||
{
|
||||
bool result = false;
|
||||
if (p1.i > p2.i) {
|
||||
result = true;
|
||||
} else if (p1.i < p2.i) {
|
||||
result = false;
|
||||
} else if (p1.param > p2.param) {
|
||||
result = true;
|
||||
} else if (p1.param < p2.param) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//return true if p1 "is equal to" p2
|
||||
/*static*/bool DrawViewPart::splitEqual(const splitPoint& p1, const splitPoint& p2)
|
||||
{
|
||||
bool result = false;
|
||||
if ((p1.i == p2.i) &&
|
||||
(fabs(p1.param - p2.param) < Precision::Confusion())) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
|
||||
{
|
||||
|
@ -763,6 +494,9 @@ Base::Vector3d DrawViewPart::projectPoint(const Base::Vector3d& pt) const
|
|||
bool DrawViewPart::hasGeometry(void) const
|
||||
{
|
||||
bool result = false;
|
||||
if (geometryObject == nullptr) {
|
||||
return result;
|
||||
}
|
||||
const std::vector<TechDrawGeometry::Vertex*> &verts = getVertexGeometry();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*> &edges = getEdgeGeometry();
|
||||
if (verts.empty() &&
|
||||
|
@ -802,18 +536,15 @@ std::vector<DrawViewSection*> DrawViewPart::getSectionRefs(void) const
|
|||
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> DrawViewPart::getVisibleFaceEdges() const
|
||||
{
|
||||
return geometryObject->getVisibleFaceEdges();
|
||||
return geometryObject->getVisibleFaceEdges(SmoothVisible.getValue(),SeamVisible.getValue());
|
||||
}
|
||||
|
||||
void DrawViewPart::getRunControl()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/RunControl");
|
||||
m_interAlgo = hGrp->GetInt("InterAlgo", 2l);
|
||||
m_sectionEdges = hGrp->GetBool("ShowSectionEdges", 1l);
|
||||
m_handleFaces = hGrp->GetBool("HandleFaces", 1l);
|
||||
// Base::Console().Message("TRACE - DVP::getRunControl - interAlgo: %ld sectionFaces: %ld handleFaces: %ld\n",
|
||||
// m_interAlgo,m_sectionEdges,m_handleFaces);
|
||||
}
|
||||
|
||||
bool DrawViewPart::handleFaces(void)
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
#include <App/DocumentObject.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
#include "DrawView.h"
|
||||
#include <App/FeaturePython.h>
|
||||
|
||||
#include <Base/BoundBox.h>
|
||||
|
||||
//#include "GeometryObject.h"
|
||||
#include "DrawView.h"
|
||||
#include "DrawProjectSplit.h"
|
||||
|
||||
class gp_Pnt;
|
||||
|
||||
|
@ -55,11 +55,7 @@ class DrawHatch;
|
|||
|
||||
namespace TechDraw
|
||||
{
|
||||
struct splitPoint {
|
||||
int i;
|
||||
Base::Vector3d v;
|
||||
double param;
|
||||
};
|
||||
|
||||
class DrawViewSection;
|
||||
|
||||
class TechDrawExport DrawViewPart : public DrawView
|
||||
|
@ -72,7 +68,6 @@ public:
|
|||
|
||||
App::PropertyLink Source; //Part Feature
|
||||
App::PropertyVector Direction; //TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
|
||||
//App::PropertyVector XAxisDirection;
|
||||
App::PropertyBool SeamVisible;
|
||||
App::PropertyBool SmoothVisible;
|
||||
//App::PropertyBool OutlinesVisible;
|
||||
|
@ -90,7 +85,6 @@ public:
|
|||
App::PropertyFloat IsoWidth;
|
||||
App::PropertyBool ArcCenterMarks;
|
||||
App::PropertyFloat CenterScale;
|
||||
App::PropertyFloatConstraint Tolerance;
|
||||
App::PropertyBool HorizCenterLine;
|
||||
App::PropertyBool VertCenterLine;
|
||||
App::PropertyBool ShowSectionLine;
|
||||
|
@ -144,31 +138,21 @@ protected:
|
|||
Base::BoundBox3d bbox;
|
||||
|
||||
void onChanged(const App::Property* prop);
|
||||
void buildGeometryObject(TopoDS_Shape shape, gp_Pnt& center);
|
||||
TechDrawGeometry::GeometryObject* buildGeometryObject(TopoDS_Shape shape, gp_Pnt& center);
|
||||
void extractFaces();
|
||||
|
||||
bool isOnEdge(TopoDS_Edge e, TopoDS_Vertex v, double& param, bool allowEnds = false);
|
||||
std::vector<TopoDS_Edge> splitEdges(std::vector<TopoDS_Edge> orig, std::vector<splitPoint> splits);
|
||||
std::vector<TopoDS_Edge> split1Edge(TopoDS_Edge e, std::vector<splitPoint> splitPoints);
|
||||
double simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2); //const; //probably sb static or DrawUtil
|
||||
|
||||
//Projection parameter space
|
||||
void saveParamSpace(const Base::Vector3d& direction);
|
||||
Base::Vector3d uDir; //paperspace X
|
||||
Base::Vector3d vDir; //paperspace Y
|
||||
Base::Vector3d wDir; //paperspace Z
|
||||
Base::Vector3d shapeCentroid;
|
||||
std::vector<splitPoint> sortSplits(std::vector<splitPoint>& s, bool ascend);
|
||||
static bool splitCompare(const splitPoint& p1, const splitPoint& p2);
|
||||
static bool splitEqual(const splitPoint& p1, const splitPoint& p2);
|
||||
void getRunControl(void);
|
||||
|
||||
long int m_interAlgo;
|
||||
bool m_sectionEdges;
|
||||
bool m_handleFaces;
|
||||
|
||||
private:
|
||||
static App::PropertyFloatConstraint::Constraints floatRange;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "EdgeWalker.h"
|
||||
#include "DrawProjectSplit.h"
|
||||
#include "DrawViewSection.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
@ -219,9 +220,6 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
|
|||
return DrawView::execute();
|
||||
}
|
||||
|
||||
geometryObject->setTolerance(Tolerance.getValue());
|
||||
geometryObject->setScale(Scale.getValue());
|
||||
|
||||
gp_Pnt inputCenter;
|
||||
try {
|
||||
inputCenter = TechDrawGeometry::findCentroid(rawShape,
|
||||
|
@ -229,7 +227,7 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
|
|||
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(rawShape,
|
||||
inputCenter,
|
||||
Scale.getValue());
|
||||
buildGeometryObject(mirroredShape,inputCenter); //this is original shape after cut by section prism
|
||||
geometryObject = buildGeometryObject(mirroredShape,inputCenter); //this is original shape after cut by section prism
|
||||
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
extractFaces();
|
||||
|
|
|
@ -38,10 +38,8 @@
|
|||
#include <gp_Elips.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
//#include <HLRTopoBRep_OutLiner.hxx>
|
||||
#include <HLRBRep.hxx>
|
||||
#include <HLRBRep_Algo.hxx>
|
||||
//#include <HLRBRep_Data.hxx>
|
||||
#include <HLRBRep_HLRToShape.hxx>
|
||||
#include <HLRAlgo_Projector.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
@ -69,8 +67,6 @@
|
|||
#include "GeometryObject.h"
|
||||
#include "DrawViewPart.h"
|
||||
|
||||
//#include <QDebug>
|
||||
|
||||
using namespace TechDrawGeometry;
|
||||
using namespace TechDraw;
|
||||
using namespace std;
|
||||
|
@ -80,11 +76,9 @@ struct EdgePoints {
|
|||
TopoDS_Edge edge;
|
||||
};
|
||||
|
||||
|
||||
GeometryObject::GeometryObject(DrawViewPart* parent) :
|
||||
Tolerance(0.05f),
|
||||
GeometryObject::GeometryObject(std::string parent) :
|
||||
Scale(1.f),
|
||||
m_parent(parent),
|
||||
m_parentName(parent),
|
||||
m_isoCount(0)
|
||||
{
|
||||
}
|
||||
|
@ -94,21 +88,18 @@ GeometryObject::~GeometryObject()
|
|||
clear();
|
||||
}
|
||||
|
||||
void GeometryObject::setTolerance(double value)
|
||||
{
|
||||
Tolerance = value;
|
||||
}
|
||||
|
||||
void GeometryObject::setScale(double value)
|
||||
{
|
||||
Scale = value;
|
||||
}
|
||||
|
||||
const std::vector<BaseGeom *> GeometryObject::getVisibleFaceEdges() const
|
||||
|
||||
const std::vector<BaseGeom *> GeometryObject::getVisibleFaceEdges(const bool smooth, const bool seam) const
|
||||
{
|
||||
std::vector<BaseGeom *> result;
|
||||
bool smoothOK = m_parent->SmoothVisible.getValue();
|
||||
bool seamOK = m_parent->SeamVisible.getValue();
|
||||
bool smoothOK = smooth;
|
||||
bool seamOK = seam;
|
||||
|
||||
for (auto& e:edgeGeom) {
|
||||
if (e->visible) {
|
||||
switch (e->classOfEdge) {
|
||||
|
@ -184,7 +175,7 @@ void GeometryObject::projectShape(const TopoDS_Shape& input,
|
|||
auto end = chrono::high_resolution_clock::now();
|
||||
auto diff = end - start;
|
||||
double diffOut = chrono::duration <double, milli> (diff).count();
|
||||
Base::Console().Log("TIMING - %s GO spent: %.3f millisecs in HLRBRep_Algo & co\n",m_parent->getNameInDocument(),diffOut);
|
||||
Base::Console().Log("TIMING - %s GO spent: %.3f millisecs in HLRBRep_Algo & co\n",m_parentName.c_str(),diffOut);
|
||||
|
||||
try {
|
||||
HLRBRep_HLRToShape hlrToShape(brep_hlr);
|
||||
|
@ -297,7 +288,6 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
|||
//add vertices of new edge if not already in list
|
||||
if (visible) {
|
||||
BaseGeom* lastAdded = edgeGeom.back();
|
||||
//if (edgeGeom.empty()) {horrible_death();} //back() undefined behavior (can't happen? baseFactory always returns a Base?)
|
||||
bool v1Add = true, v2Add = true;
|
||||
bool c1Add = true;
|
||||
TechDrawGeometry::Vertex* v1 = new TechDrawGeometry::Vertex(lastAdded->getStartPoint());
|
||||
|
@ -754,24 +744,22 @@ TopoDS_Shape TechDrawGeometry::mirrorShape(const TopoDS_Shape &input,
|
|||
return transShape;
|
||||
}
|
||||
|
||||
/// debug functions
|
||||
/* TODO: Clean this up when faces are actually working properly...
|
||||
|
||||
void debugEdge(const TopoDS_Edge &e)
|
||||
|
||||
//!scales a shape about a origin
|
||||
TopoDS_Shape TechDrawGeometry::scaleShape(const TopoDS_Shape &input,
|
||||
double scale)
|
||||
{
|
||||
TopoDS_Shape transShape;
|
||||
try {
|
||||
gp_Trsf scaleTransform;
|
||||
scaleTransform.SetScale(gp_Pnt(0,0,0), scale);
|
||||
|
||||
gp_Pnt p0 = BRep_Tool::Pnt(TopExp::FirstVertex(e));
|
||||
|
||||
gp_Pnt p1 = BRep_Tool::Pnt(TopExp::LastVertex(e));
|
||||
|
||||
qDebug()<<p0.X()<<','<<p0.Y()<<','<<p0.Z()<<"\t - \t"<<p1.X()<<','<<p1.Y()<<','<<p1.Z();
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
const char* _printBool(bool b)
|
||||
{
|
||||
return (b ? "True" : "False");
|
||||
BRepBuilderAPI_Transform mkTrf(input, scaleTransform);
|
||||
transShape = mkTrf.Shape();
|
||||
}
|
||||
catch (...) {
|
||||
Base::Console().Log("GeometryObject::scaleShape - scale failed.\n");
|
||||
return transShape;
|
||||
}
|
||||
return transShape;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
//#include <HLRBRep_Data.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
|
@ -33,7 +32,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Geometry.h"
|
||||
//#include "DrawViewPart.h"
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
@ -48,6 +46,8 @@ namespace TechDrawGeometry
|
|||
TopoDS_Shape TechDrawExport mirrorShape(const TopoDS_Shape &input,
|
||||
const gp_Pnt& inputCenter,
|
||||
double scale);
|
||||
TopoDS_Shape TechDrawExport scaleShape(const TopoDS_Shape &input,
|
||||
double scale);
|
||||
|
||||
//! Returns the centroid of shape, as viewed according to direction
|
||||
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
|
||||
|
@ -61,12 +61,11 @@ class TechDrawExport GeometryObject
|
|||
{
|
||||
public:
|
||||
/// Constructor
|
||||
GeometryObject(TechDraw::DrawViewPart* parent);
|
||||
GeometryObject(std::string parent);
|
||||
virtual ~GeometryObject();
|
||||
|
||||
void clear();
|
||||
|
||||
void setTolerance(double value);
|
||||
void setScale(double value);
|
||||
|
||||
//! Returns 2D bounding box
|
||||
|
@ -74,7 +73,7 @@ public:
|
|||
|
||||
const std::vector<Vertex *> & getVertexGeometry() const { return vertexGeom; };
|
||||
const std::vector<BaseGeom *> & getEdgeGeometry() const { return edgeGeom; };
|
||||
const std::vector<BaseGeom *> getVisibleFaceEdges() const;
|
||||
const std::vector<BaseGeom *> getVisibleFaceEdges(bool smooth, bool seam) const;
|
||||
const std::vector<Face *> & getFaceGeometry() const { return faceGeom; };
|
||||
|
||||
void projectShape(const TopoDS_Shape &input,
|
||||
|
@ -84,6 +83,7 @@ public:
|
|||
void addFaceGeom(Face * f);
|
||||
void clearFaceGeom();
|
||||
void setIsoCount(int i) { m_isoCount = i; }
|
||||
void setParentName(std::string n); //for debug messages
|
||||
|
||||
protected:
|
||||
//HLR output
|
||||
|
@ -128,10 +128,9 @@ protected:
|
|||
|
||||
bool findVertex(Base::Vector2D v);
|
||||
|
||||
double Tolerance;
|
||||
double Scale;
|
||||
|
||||
TechDraw::DrawViewPart* m_parent;
|
||||
std::string m_parentName;
|
||||
int m_isoCount;
|
||||
};
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "ViewProviderViewClip.h"
|
||||
#include "ViewProviderHatch.h"
|
||||
#include "ViewProviderSpreadsheet.h"
|
||||
#include "ViewProviderImage.h"
|
||||
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
void CreateTechDrawCommands(void);
|
||||
|
@ -100,6 +102,7 @@ void TechDrawGuiExport initTechDrawGui()
|
|||
TechDrawGui::ViewProviderArch::init();
|
||||
TechDrawGui::ViewProviderHatch::init();
|
||||
TechDrawGui::ViewProviderSpreadsheet::init();
|
||||
TechDrawGui::ViewProviderImage::init();
|
||||
|
||||
// register preferences pages
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawImp> ("TechDraw");
|
||||
|
|
|
@ -103,6 +103,8 @@ SET(TechDrawGuiView_SRCS
|
|||
QGCustomLabel.h
|
||||
QGCustomBorder.cpp
|
||||
QGCustomBorder.h
|
||||
QGCustomImage.cpp
|
||||
QGCustomImage.h
|
||||
QGIView.cpp
|
||||
QGIView.h
|
||||
QGIArrow.cpp
|
||||
|
@ -135,6 +137,8 @@ SET(TechDrawGuiView_SRCS
|
|||
QGIViewSymbol.h
|
||||
QGIViewSpreadsheet.cpp
|
||||
QGIViewSpreadsheet.h
|
||||
QGIViewImage.cpp
|
||||
QGIViewImage.h
|
||||
QGIViewClip.cpp
|
||||
QGIViewClip.h
|
||||
QGIPrimPath.cpp
|
||||
|
@ -180,6 +184,8 @@ SET(TechDrawGuiViewProvider_SRCS
|
|||
ViewProviderViewClip.h
|
||||
ViewProviderHatch.cpp
|
||||
ViewProviderHatch.h
|
||||
ViewProviderImage.cpp
|
||||
ViewProviderImage.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP("Mod" FILES ${TechDrawGui_SRCS})
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawViewDraft.h>
|
||||
#include <Mod/TechDraw/App/DrawViewMulti.h>
|
||||
#include <Mod/TechDraw/Gui/QGVPage.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
|
@ -442,6 +443,58 @@ bool CmdTechDrawProjGroup::isActive(void)
|
|||
return (havePage && !taskInProgress);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_NewMulti
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawNewMulti);
|
||||
|
||||
CmdTechDrawNewMulti::CmdTechDrawNewMulti()
|
||||
: Command("TechDraw_NewMulti")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Insert multi-part view in drawing");
|
||||
sToolTipText = QT_TR_NOOP("Insert a new View of a multiple Parts in the active drawing");
|
||||
sWhatsThis = "TechDraw_NewMulti";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-multiview";
|
||||
}
|
||||
|
||||
void CmdTechDrawNewMulti::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::vector<App::DocumentObject*>& shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId());
|
||||
if (shapes.empty()) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("Select at least 1 Part object."));
|
||||
return;
|
||||
}
|
||||
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
Gui::WaitCursor wc;
|
||||
|
||||
openCommand("Create view");
|
||||
std::string FeatName = getUniqueObjectName("MultiView");
|
||||
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewMulti','%s')",FeatName.c_str());
|
||||
App::DocumentObject *docObj = getDocument()->getObject(FeatName.c_str());
|
||||
auto multiView( static_cast<TechDraw::DrawViewMulti *>(docObj) );
|
||||
multiView->Sources.setValues(shapes);
|
||||
doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
||||
bool CmdTechDrawNewMulti::isActive(void)
|
||||
{
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Annotation
|
||||
|
@ -826,7 +879,7 @@ void CmdTechDrawArchView::activated(int iMsg)
|
|||
QObject::tr("The selected object is not an Arch Section Plane."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
std::string FeatName = getUniqueObjectName("ArchView");
|
||||
|
@ -957,6 +1010,7 @@ void CreateTechDrawCommands(void)
|
|||
rcCmdMgr.addCommand(new CmdTechDrawNewPage());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawNewView());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawNewViewSection());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawNewMulti());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawProjGroup());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawAnnotation());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawClip());
|
||||
|
|
|
@ -865,14 +865,20 @@ void CmdTechDrawLinkDimension::activated(int iMsg)
|
|||
return;
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
Part::Feature* obj3D = 0;
|
||||
|
||||
App::DocumentObject* obj3D = 0;
|
||||
std::vector<App::DocumentObject*> parts;
|
||||
std::vector<std::string> subs;
|
||||
|
||||
std::vector<Gui::SelectionObject>::iterator itSel = selection.begin();
|
||||
for (; itSel != selection.end(); itSel++) {
|
||||
if ((*itSel).getObject()->isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
obj3D = static_cast<Part::Feature*> ((*itSel).getObject());
|
||||
subs = (*itSel).getSubNames();
|
||||
obj3D = ((*itSel).getObject());
|
||||
std::vector<std::string> subList = (*itSel).getSubNames();
|
||||
for (auto& s:subList) {
|
||||
parts.push_back(obj3D);
|
||||
subs.push_back(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -890,7 +896,7 @@ void CmdTechDrawLinkDimension::activated(int iMsg)
|
|||
|
||||
|
||||
// dialog to select the Dimension to link
|
||||
Gui::Control().showDialog(new TaskDlgLinkDim(obj3D,subs,page));
|
||||
Gui::Control().showDialog(new TaskDlgLinkDim(parts,subs,page));
|
||||
|
||||
page->getDocument()->recompute(); //still need to recompute in Gui. why?
|
||||
}
|
||||
|
|
|
@ -126,6 +126,58 @@ bool CmdTechDrawNewHatch::isActive(void)
|
|||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Image
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawImage);
|
||||
|
||||
CmdTechDrawImage::CmdTechDrawImage()
|
||||
: Command("TechDraw_Image")
|
||||
{
|
||||
// setting the Gui eye-candy
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Insert bitmap image");
|
||||
sToolTipText = QT_TR_NOOP("Inserts a bitmap from a file in the active drawing");
|
||||
sWhatsThis = "TechDraw_Image";
|
||||
sStatusTip = QT_TR_NOOP("Inserts a bitmap from a file in the active drawing");
|
||||
sPixmap = "actions/techdraw-image";
|
||||
}
|
||||
|
||||
void CmdTechDrawImage::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
// Reading an image
|
||||
std::string defaultDir = App::Application::getResourceDir();
|
||||
QString qDir = QString::fromUtf8(defaultDir.data(),defaultDir.size());
|
||||
QString fileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
|
||||
QString::fromUtf8(QT_TR_NOOP("Select an Image File")),
|
||||
qDir,
|
||||
QString::fromUtf8(QT_TR_NOOP("Image (*.png *.jpg *.jpeg)")));
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
std::string FeatName = getUniqueObjectName("Image");
|
||||
openCommand("Create Image");
|
||||
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewImage','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.ImageFile = '%s'",FeatName.c_str(),fileName.toUtf8().constData());
|
||||
doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdTechDrawImage::isActive(void)
|
||||
{
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_ToggleFrame
|
||||
//===========================================================================
|
||||
|
@ -178,6 +230,7 @@ void CreateTechDrawCommandsDecorate(void)
|
|||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
rcCmdMgr.addCommand(new CmdTechDrawNewHatch());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawImage());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawToggleFrame());
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include <Mod/TechDraw/App/DrawViewSection.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSpreadsheet.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
|
||||
#include "QGIDrawingTemplate.h"
|
||||
#include "QGIView.h"
|
||||
|
@ -315,6 +316,9 @@ bool MDIViewPage::attachView(App::DocumentObject *obj)
|
|||
} else if (typeId.isDerivedFrom(TechDraw::DrawViewSpreadsheet::getClassTypeId()) ) {
|
||||
qview = m_view->addDrawViewSpreadsheet( static_cast<TechDraw::DrawViewSpreadsheet *>(obj) );
|
||||
|
||||
} else if (typeId.isDerivedFrom(TechDraw::DrawViewImage::getClassTypeId()) ) {
|
||||
qview = m_view->addDrawViewImage( static_cast<TechDraw::DrawViewImage *>(obj) );
|
||||
|
||||
} else if (typeId.isDerivedFrom(TechDraw::DrawHatch::getClassTypeId()) ) {
|
||||
//Hatch is not attached like other Views (since it isn't really a View)
|
||||
return true;
|
||||
|
|
92
src/Mod/TechDraw/Gui/QGCustomImage.cpp
Normal file
92
src/Mod/TechDraw/Gui/QGCustomImage.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QtGlobal>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include <QRectF>
|
||||
#include <QPixmap>
|
||||
#include "QGCustomImage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGCustomImage::QGCustomImage()
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setAcceptHoverEvents(false);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
}
|
||||
|
||||
QGCustomImage::~QGCustomImage()
|
||||
{
|
||||
}
|
||||
|
||||
void QGCustomImage::centerAt(QPointF centerPos)
|
||||
{
|
||||
centerAt(centerPos.x(),centerPos.y());
|
||||
}
|
||||
|
||||
void QGCustomImage::centerAt(double cX, double cY)
|
||||
{
|
||||
// QGraphicsItemGroup* g = group();
|
||||
// if (g == nullptr) {
|
||||
// return;
|
||||
// }
|
||||
QPointF parentPt(cX,cY);
|
||||
QPointF myPt = mapFromParent(parentPt);
|
||||
|
||||
QRectF br = boundingRect();
|
||||
double width = br.width();
|
||||
double height = br.height();
|
||||
double newX = width/2.0;
|
||||
double newY = height/2.0;
|
||||
QPointF off(myPt.x() - newX,myPt.y() - newY);
|
||||
setOffset(off);
|
||||
}
|
||||
|
||||
bool QGCustomImage::load(QString fileSpec)
|
||||
{
|
||||
bool success = true;
|
||||
QPixmap px(fileSpec);
|
||||
m_px = px;
|
||||
// if (m_px.isNull()) {
|
||||
// Base::Console().Message("TRACE - QGCustomImage::load - pixmap no good\n");
|
||||
// }
|
||||
prepareGeometryChange();
|
||||
setPixmap(m_px);
|
||||
return(success);
|
||||
}
|
||||
|
||||
void QGCustomImage::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
QGraphicsPixmapItem::paint (painter, &myOption, widget);
|
||||
}
|
63
src/Mod/TechDraw/Gui/QGCustomImage.h
Normal file
63
src/Mod/TechDraw/Gui/QGCustomImage.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DRAWINGGUI_QGCUSTOMIMAGE_H
|
||||
#define DRAWINGGUI_QGCUSTOMIMAGE_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QPointF>
|
||||
#include <QByteArray>
|
||||
#include <QPixmap>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
class TechDrawGuiExport QGCustomImage : public QGraphicsPixmapItem
|
||||
{
|
||||
public:
|
||||
explicit QGCustomImage(void);
|
||||
~QGCustomImage();
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 201};
|
||||
int type() const override { return Type;}
|
||||
|
||||
virtual void paint( QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = nullptr ) override;
|
||||
virtual void centerAt(QPointF centerPos);
|
||||
virtual void centerAt(double cX, double cY);
|
||||
virtual bool load(QString fileSpec);
|
||||
|
||||
protected:
|
||||
QPixmap m_px;
|
||||
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
#endif // DRAWINGGUI_QGCUSTOMIMAGE_H
|
|
@ -51,22 +51,26 @@ QGCustomSvg::~QGCustomSvg()
|
|||
|
||||
void QGCustomSvg::centerAt(QPointF centerPos)
|
||||
{
|
||||
QRectF box = boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = centerPos.x() - width/2.;
|
||||
double newY = centerPos.y() - height/2.;
|
||||
setPos(newX,newY);
|
||||
if (group()) {
|
||||
QRectF box = group()->boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = centerPos.x() - width/2.;
|
||||
double newY = centerPos.y() - height/2.;
|
||||
setPos(newX,newY);
|
||||
}
|
||||
}
|
||||
|
||||
void QGCustomSvg::centerAt(double cX, double cY)
|
||||
{
|
||||
QRectF box = boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = cX - width/2.;
|
||||
double newY = cY - height/2.;
|
||||
setPos(newX,newY);
|
||||
if (group()) {
|
||||
QRectF box = group()->boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = cX - width/2.;
|
||||
double newY = cY - height/2.;
|
||||
setPos(newX,newY);
|
||||
}
|
||||
}
|
||||
|
||||
bool QGCustomSvg::load(QByteArray *svgBytes)
|
||||
|
@ -82,7 +86,7 @@ QRectF QGCustomSvg::boundingRect() const
|
|||
QRectF box = m_svgRender->viewBoxF();
|
||||
double w = box.width();
|
||||
double h = box.height();
|
||||
QRectF newRect(0,0,w*scale(),h*scale());
|
||||
QRectF newRect(0,0,w,h);
|
||||
return newRect.adjusted(-1.,-1.,1.,1.);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ QGISectionLine: 172
|
|||
QGIDecoration: 173
|
||||
QGICenterLine: 174
|
||||
QGICaption: 180
|
||||
QGIViewImage: 200
|
||||
QGCustomImage: 201
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -403,6 +403,8 @@ void QGIView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
|
|||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
//painter->drawRect(boundingRect());
|
||||
|
||||
QGraphicsItemGroup::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
|
|
144
src/Mod/TechDraw/Gui/QGIViewImage.cpp
Normal file
144
src/Mod/TechDraw/Gui/QGIViewImage.cpp
Normal file
|
@ -0,0 +1,144 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <cmath>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QString>
|
||||
#include <sstream>
|
||||
#include <QRectF>
|
||||
#endif
|
||||
|
||||
//#include <qmath.h>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
|
||||
#include "QGCustomImage.h"
|
||||
#include "QGCustomClip.h"
|
||||
#include "QGIViewImage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewImage::QGIViewImage()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setAcceptHoverEvents(true);
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
|
||||
m_cliparea = new QGCustomClip();
|
||||
addToGroup(m_cliparea);
|
||||
m_cliparea->setPos(0.,0.);
|
||||
m_cliparea->setRect(0.,0.,5.,5.);
|
||||
|
||||
m_imageItem = new QGCustomImage();
|
||||
m_cliparea->addToGroup(m_imageItem);
|
||||
m_imageItem->setPos(0.,0.);
|
||||
}
|
||||
|
||||
QGIViewImage::~QGIViewImage()
|
||||
{
|
||||
// m_imageItem belongs to this group and will be deleted by Qt
|
||||
}
|
||||
|
||||
QVariant QGIViewImage::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
|
||||
return QGIView::itemChange(change, value);
|
||||
}
|
||||
|
||||
void QGIViewImage::setViewImageFeature(TechDraw::DrawViewImage *obj)
|
||||
{
|
||||
setViewFeature(static_cast<TechDraw::DrawView *>(obj));
|
||||
}
|
||||
|
||||
void QGIViewImage::updateView(bool update)
|
||||
{
|
||||
auto viewImage( dynamic_cast<TechDraw::DrawViewImage *>(getViewObject()) );
|
||||
if( viewImage == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (update ||
|
||||
viewImage->isTouched() ||
|
||||
viewImage->Width.isTouched() ||
|
||||
viewImage->Height.isTouched() ||
|
||||
viewImage->ImageFile.isTouched()) {
|
||||
draw();
|
||||
}
|
||||
|
||||
if (viewImage->Scale.isTouched()) {
|
||||
draw();
|
||||
}
|
||||
|
||||
QGIView::updateView(update);
|
||||
}
|
||||
|
||||
void QGIViewImage::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto viewImage( dynamic_cast<TechDraw::DrawViewImage*>(getViewObject()) );
|
||||
QRectF newRect(0.0,0.0,viewImage->Width.getValue(),viewImage->Height.getValue());
|
||||
m_cliparea->setRect(newRect.adjusted(-1,-1,1,1));
|
||||
|
||||
drawImage();
|
||||
if (borderVisible) {
|
||||
drawBorder();
|
||||
}
|
||||
}
|
||||
|
||||
void QGIViewImage::drawImage()
|
||||
{
|
||||
auto viewImage( dynamic_cast<TechDraw::DrawViewImage *>(getViewObject()) );
|
||||
if( viewImage == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!viewImage->ImageFile.isEmpty()) {
|
||||
QString fileSpec = QString::fromUtf8(viewImage->ImageFile.getValue(),strlen(viewImage->ImageFile.getValue()));
|
||||
m_imageItem->load(fileSpec);
|
||||
m_imageItem->setScale(viewImage->Scale.getValue());
|
||||
QRectF br = m_cliparea->rect();
|
||||
double midX = br.width()/2.0;
|
||||
double midY = br.height()/2.0;
|
||||
m_imageItem->centerAt(midX,midY);
|
||||
m_imageItem->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
64
src/Mod/TechDraw/Gui/QGIViewImage.h
Normal file
64
src/Mod/TechDraw/Gui/QGIViewImage.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DRAWINGGUI_QGRAPHICSITEMVIEWIMAGE_H
|
||||
#define DRAWINGGUI_QGRAPHICSITEMVIEWIMAGE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
#include <QString>
|
||||
|
||||
#include "QGIView.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawViewImage;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
class QGCustomImage;
|
||||
class QGCustomClip;
|
||||
|
||||
class TechDrawGuiExport QGIViewImage : public QGIView
|
||||
{
|
||||
public:
|
||||
QGIViewImage();
|
||||
~QGIViewImage();
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 200};
|
||||
int type() const override { return Type;}
|
||||
|
||||
virtual void updateView(bool update = false) override;
|
||||
void setViewImageFeature(TechDraw::DrawViewImage *obj);
|
||||
|
||||
virtual void draw() override;
|
||||
|
||||
protected:
|
||||
virtual void drawImage();
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||
|
||||
QGCustomImage* m_imageItem;
|
||||
QGCustomClip* m_cliparea;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
#endif // DRAWINGGUI_QGRAPHICSITEMVIEWIMAGE_H
|
|
@ -250,7 +250,6 @@ void QGIViewPart::updateView(bool update)
|
|||
viewPart->isTouched() ||
|
||||
viewPart->Source.isTouched() ||
|
||||
viewPart->Direction.isTouched() ||
|
||||
viewPart->Tolerance.isTouched() ||
|
||||
viewPart->Scale.isTouched() ||
|
||||
viewPart->HardHidden.isTouched() ||
|
||||
viewPart->SmoothVisible.isTouched() ||
|
||||
|
@ -290,6 +289,9 @@ void QGIViewPart::drawViewPart()
|
|||
if ( viewPart == nullptr ) {
|
||||
return;
|
||||
}
|
||||
if (!viewPart->hasGeometry()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float lineWidth = viewPart->LineWidth.getValue() * lineScaleFactor;
|
||||
float lineWidthHid = viewPart->HiddenWidth.getValue() * lineScaleFactor;
|
||||
|
|
|
@ -59,7 +59,7 @@ QGIViewSymbol::QGIViewSymbol()
|
|||
|
||||
m_svgItem = new QGCustomSvg();
|
||||
addToGroup(m_svgItem);
|
||||
m_svgItem->setPos(0.,0.);
|
||||
m_svgItem->centerAt(0.,0.);
|
||||
}
|
||||
|
||||
QGIViewSymbol::~QGIViewSymbol()
|
||||
|
@ -137,5 +137,5 @@ void QGIViewSymbol::symbolToSvg(QByteArray qba)
|
|||
if (!m_svgItem->load(&qba)) {
|
||||
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n", getViewObject()->getNameInDocument());
|
||||
}
|
||||
m_svgItem->setPos(0.,0.);
|
||||
m_svgItem->centerAt(0.,0.);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <Mod/TechDraw/App/DrawViewClip.h>
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSpreadsheet.h>
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
|
||||
|
||||
#include "QGIDrawingTemplate.h"
|
||||
|
@ -73,6 +74,7 @@
|
|||
#include "QGIViewSymbol.h"
|
||||
#include "QGIViewClip.h"
|
||||
#include "QGIViewSpreadsheet.h"
|
||||
#include "QGIViewImage.h"
|
||||
#include "QGIFace.h"
|
||||
|
||||
#include "ZVALUE.h"
|
||||
|
@ -287,6 +289,17 @@ QGIView * QGVPage::addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet *view)
|
|||
return qview;
|
||||
}
|
||||
|
||||
QGIView * QGVPage::addDrawViewImage(TechDraw::DrawViewImage *view)
|
||||
{
|
||||
QPoint qp(view->X.getValue(),view->Y.getValue());
|
||||
auto qview( new QGIViewImage );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
|
||||
addView(qview);
|
||||
return qview;
|
||||
}
|
||||
|
||||
QGIView * QGVPage::addViewDimension(TechDraw::DrawViewDimension *dim)
|
||||
{
|
||||
auto dimGroup( new QGIViewDimension );
|
||||
|
|
|
@ -37,6 +37,7 @@ class DrawViewSymbol;
|
|||
class DrawViewClip;
|
||||
class DrawViewCollection;
|
||||
class DrawViewSpreadsheet;
|
||||
class DrawViewImage;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
|
@ -69,6 +70,8 @@ public:
|
|||
QGIView * addDrawViewSymbol(TechDraw::DrawViewSymbol *view);
|
||||
QGIView * addDrawViewClip(TechDraw::DrawViewClip *view);
|
||||
QGIView * addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet *view);
|
||||
QGIView * addDrawViewImage(TechDraw::DrawViewImage *view);
|
||||
|
||||
|
||||
QGIView * findView(App::DocumentObject *obj) const;
|
||||
QGIView * findParent(QGIView *) const;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<file>icons/TechDraw_Tree_Spreadsheet.svg</file>
|
||||
<file>icons/TechDraw_Tree_Symbol.svg</file>
|
||||
<file>icons/TechDraw_Tree_View.svg</file>
|
||||
<file>icons/TechDraw_Tree_Multi.svg</file>
|
||||
<file>icons/TechDraw_Pages.svg</file>
|
||||
<file>icons/TechDraw_ProjBottom.svg</file>
|
||||
<file>icons/TechDraw_ProjFront.svg</file>
|
||||
|
@ -32,6 +33,7 @@
|
|||
<file>icons/actions/techdraw-new-default.svg</file>
|
||||
<file>icons/actions/techdraw-new-pick.svg</file>
|
||||
<file>icons/actions/techdraw-view.svg</file>
|
||||
<file>icons/actions/techdraw-multiview.svg</file>
|
||||
<file>icons/actions/techdraw-annotation.svg</file>
|
||||
<file>icons/actions/techdraw-clip.svg</file>
|
||||
<file>icons/actions/techdraw-clipplus.svg</file>
|
||||
|
@ -45,6 +47,7 @@
|
|||
<file>icons/actions/techdraw-toggleframe.svg</file>
|
||||
<file>icons/actions/techdraw-projgroup.svg</file>
|
||||
<file>icons/actions/techdraw-spreadsheet.svg</file>
|
||||
<file>icons/actions/techdraw-image.svg</file>
|
||||
<file>icons/actions/section-up.svg</file>
|
||||
<file>icons/actions/section-down.svg</file>
|
||||
<file>icons/actions/section-left.svg</file>
|
||||
|
|
57
src/Mod/TechDraw/Gui/Resources/icons/TechDraw_Tree_Multi.svg
Normal file
57
src/Mod/TechDraw/Gui/Resources/icons/TechDraw_Tree_Multi.svg
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="32"
|
||||
height="32"
|
||||
id="svg2160">
|
||||
<defs
|
||||
id="defs2162" />
|
||||
<metadata
|
||||
id="metadata2165">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1">
|
||||
<rect
|
||||
width="26.993866"
|
||||
height="26.077709"
|
||||
x="2.503067"
|
||||
y="2.9611454"
|
||||
id="rect4138"
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:2, 1;stroke-dashoffset:0" />
|
||||
<path
|
||||
d="m 25.423312,21.006134 a 2.4703476,2.4867074 0 1 1 -4.940695,0 2.4703476,2.4867074 0 1 1 4.940695,0 z"
|
||||
transform="matrix(1.2564721,0,0,1.1561006,-18.561068,-3.3341851)"
|
||||
id="path7049"
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<rect
|
||||
width="7.4961996"
|
||||
height="7.2185626"
|
||||
rx="0"
|
||||
ry="0.086343832"
|
||||
x="6.4618368"
|
||||
y="6.1279535"
|
||||
id="rect3063"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.21000004;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 22.581145,10.159222 4.889026,3.821039 -2.123232,5.830506 -6.201256,-0.217588 -1.709355,-5.964983 z"
|
||||
transform="translate(-0.01636028,1.5214726)"
|
||||
id="path3833"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.21000004;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
481
src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-image.svg
Normal file
481
src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-image.svg
Normal file
|
@ -0,0 +1,481 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg249"
|
||||
height="48"
|
||||
width="48"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="techdraw-image.svg">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="693"
|
||||
id="namedview3431"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1"
|
||||
inkscape:cx="11.977316"
|
||||
inkscape:cy="24"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg249" />
|
||||
<defs
|
||||
id="defs3">
|
||||
<radialGradient
|
||||
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient5060"
|
||||
id="radialGradient5031"
|
||||
fy="486.64789"
|
||||
fx="605.71429"
|
||||
r="117.14286"
|
||||
cy="486.64789"
|
||||
cx="605.71429" />
|
||||
<linearGradient
|
||||
id="linearGradient5060">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
id="stop5062" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
id="stop5064" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient5060"
|
||||
id="radialGradient5029"
|
||||
fy="486.64789"
|
||||
fx="605.71429"
|
||||
r="117.14286"
|
||||
cy="486.64789"
|
||||
cx="605.71429" />
|
||||
<linearGradient
|
||||
id="linearGradient5048">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
id="stop5050" />
|
||||
<stop
|
||||
offset="0.5"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
id="stop5056" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
id="stop5052" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient5048"
|
||||
id="linearGradient5027"
|
||||
y2="609.50507"
|
||||
x2="302.85715"
|
||||
y1="366.64789"
|
||||
x1="302.85715" />
|
||||
<linearGradient
|
||||
id="linearGradient4542">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
id="stop4544" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
id="stop4546" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientTransform="matrix(1,0,0,0.284916,0,30.08928)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient4542"
|
||||
id="radialGradient4548"
|
||||
fy="42.07798"
|
||||
fx="24.306795"
|
||||
r="15.821514"
|
||||
cy="42.07798"
|
||||
cx="24.306795" />
|
||||
<linearGradient
|
||||
id="linearGradient15662">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1"
|
||||
id="stop15664" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#f8f8f8;stop-opacity:1"
|
||||
id="stop15666" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="aigrd3"
|
||||
fy="64.567902"
|
||||
fx="20.892099"
|
||||
r="5.257"
|
||||
cy="64.567902"
|
||||
cx="20.892099">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
id="stop15573" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#9a9a9a;stop-opacity:1"
|
||||
id="stop15575" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="aigrd2"
|
||||
fy="114.5684"
|
||||
fx="20.892099"
|
||||
r="5.256"
|
||||
cy="114.5684"
|
||||
cx="20.892099">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
id="stop15566" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#9a9a9a;stop-opacity:1"
|
||||
id="stop15568" />
|
||||
</radialGradient>
|
||||
<linearGradient
|
||||
id="linearGradient269">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#a3a3a3;stop-opacity:1"
|
||||
id="stop270" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#4c4c4c;stop-opacity:1"
|
||||
id="stop271" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient259">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#fafafa;stop-opacity:1"
|
||||
id="stop260" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#bbbbbb;stop-opacity:1"
|
||||
id="stop261" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient12512">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1"
|
||||
id="stop12513" />
|
||||
<stop
|
||||
offset="0.5"
|
||||
style="stop-color:#fff520;stop-opacity:0.89108908"
|
||||
id="stop12517" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#fff300;stop-opacity:0"
|
||||
id="stop12514" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.96827297,0,0,1.032767,2.9576405,-47.586563)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient269"
|
||||
id="radialGradient15656"
|
||||
fy="3.7561285"
|
||||
fx="8.824419"
|
||||
r="37.751713"
|
||||
cy="3.7561285"
|
||||
cx="8.824419" />
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.96049297,0,0,1.041132,-0.39591234,-48.23301)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient259"
|
||||
id="radialGradient15658"
|
||||
fy="35.736916"
|
||||
fx="33.966679"
|
||||
r="86.70845"
|
||||
cy="35.736916"
|
||||
cx="33.966679" />
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.96827297,0,0,1.032767,2.9576405,-47.586563)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient15662"
|
||||
id="radialGradient15668"
|
||||
fy="7.2678967"
|
||||
fx="8.1435566"
|
||||
r="38.158695"
|
||||
cy="7.2678967"
|
||||
cx="8.1435566" />
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#aigrd2"
|
||||
id="radialGradient2283"
|
||||
fy="114.5684"
|
||||
fx="20.892099"
|
||||
r="5.256"
|
||||
cy="114.5684"
|
||||
cx="20.892099" />
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#aigrd3"
|
||||
id="radialGradient2285"
|
||||
fy="64.567902"
|
||||
fx="20.892099"
|
||||
r="5.257"
|
||||
cy="64.567902"
|
||||
cx="20.892099" />
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient3377-76"
|
||||
id="linearGradient4343"
|
||||
y2="41.792759"
|
||||
x2="44.524982"
|
||||
y1="14.452502"
|
||||
x1="18.971846" />
|
||||
<linearGradient
|
||||
id="linearGradient3377-76">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
id="stop3379-5" />
|
||||
<stop
|
||||
offset="0.5"
|
||||
style="stop-color:#fcb915;stop-opacity:1"
|
||||
id="stop4345" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#c68708;stop-opacity:1"
|
||||
id="stop3381-7" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient3377-76"
|
||||
id="linearGradient4349"
|
||||
y2="108.75008"
|
||||
x2="175.6825"
|
||||
y1="79.160103"
|
||||
x1="145.64697" />
|
||||
<linearGradient
|
||||
id="linearGradient4482">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
id="stop4484" />
|
||||
<stop
|
||||
offset="0.5"
|
||||
style="stop-color:#fcb915;stop-opacity:1"
|
||||
id="stop4486" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#c68708;stop-opacity:1"
|
||||
id="stop4488" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient4351"
|
||||
fy="97.369568"
|
||||
fx="135.38333"
|
||||
r="19.467436"
|
||||
cy="97.369568"
|
||||
cx="135.38333" />
|
||||
<linearGradient
|
||||
id="linearGradient3377">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
id="stop3379" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#ffaa00;stop-opacity:1"
|
||||
id="stop3381" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient4353"
|
||||
fy="28.869568"
|
||||
fx="45.883327"
|
||||
r="19.467436"
|
||||
cy="28.869568"
|
||||
cx="45.883327" />
|
||||
<linearGradient
|
||||
id="linearGradient4495">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
id="stop4497" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#ffaa00;stop-opacity:1"
|
||||
id="stop4499" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Jakub Steiner</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:source>http://jimmac.musichall.cz</dc:source>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
style="display:inline"
|
||||
id="layer4" />
|
||||
<path
|
||||
d="M 43.217026,12.087907 5.1993156,12.102142"
|
||||
id="path15674"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.20467828" />
|
||||
<g
|
||||
id="g3433"
|
||||
transform="matrix(1.65,0,0,1.65,-15.6,-18.472941)">
|
||||
<ellipse
|
||||
style="fill:#cc0000;fill-rule:evenodd;stroke:#ef2929;stroke-width:0.40000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path3603"
|
||||
cx="24.04706"
|
||||
cy="25.905884"
|
||||
rx="2.9176471"
|
||||
ry="2.8235295" />
|
||||
<g
|
||||
id="g3609"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
transform="translate(0.42352847,1.3411761)">
|
||||
<ellipse
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)"
|
||||
ry="1.6996821"
|
||||
rx="3.2055645"
|
||||
cy="12.689981"
|
||||
cx="24.183033"
|
||||
id="path3605"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<ellipse
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="ellipse3607"
|
||||
cx="38.709206"
|
||||
cy="13.771251"
|
||||
rx="3.2055645"
|
||||
ry="1.6996821"
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3613"
|
||||
transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,24.765339,-8.1075045)"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none">
|
||||
<ellipse
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="ellipse3615"
|
||||
cx="24.183033"
|
||||
cy="12.689981"
|
||||
rx="3.2055645"
|
||||
ry="1.6996821"
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)" />
|
||||
<ellipse
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)"
|
||||
ry="1.6996821"
|
||||
rx="3.2055645"
|
||||
cy="13.771251"
|
||||
cx="38.709206"
|
||||
id="ellipse3617"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
</g>
|
||||
<g
|
||||
id="g3619"
|
||||
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,-10.107505,25.234661)"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none">
|
||||
<ellipse
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)"
|
||||
ry="1.6996821"
|
||||
rx="3.2055645"
|
||||
cy="12.689981"
|
||||
cx="24.183033"
|
||||
id="ellipse3621"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<ellipse
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="ellipse3623"
|
||||
cx="38.709206"
|
||||
cy="13.771251"
|
||||
rx="3.2055645"
|
||||
ry="1.6996821"
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)" />
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(0,-1,1,0,-0.65882393,49.576471)"
|
||||
id="g3625"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none">
|
||||
<ellipse
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="ellipse3627"
|
||||
cx="24.183033"
|
||||
cy="12.689981"
|
||||
rx="3.2055645"
|
||||
ry="1.6996821"
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)" />
|
||||
<ellipse
|
||||
transform="matrix(0.91728927,0.39822153,-0.39822153,0.91728927,0,0)"
|
||||
ry="1.6996821"
|
||||
rx="3.2055645"
|
||||
cy="13.771251"
|
||||
cx="38.709206"
|
||||
id="ellipse3629"
|
||||
style="fill:#fce94f;stroke:#c4a000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
</g>
|
||||
<rect
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-miterlimit:4;stroke-dasharray:1.6, 0.8;stroke-dashoffset:0"
|
||||
id="rect4446"
|
||||
width="25.694118"
|
||||
height="25.317648"
|
||||
x="11.152941"
|
||||
y="13.082353"
|
||||
rx="0.5"
|
||||
ry="0.5" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,500 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="1.1"
|
||||
width="48"
|
||||
height="48"
|
||||
id="svg249">
|
||||
<defs
|
||||
id="defs3">
|
||||
<radialGradient
|
||||
cx="605.71429"
|
||||
cy="486.64789"
|
||||
r="117.14286"
|
||||
fx="605.71429"
|
||||
fy="486.64789"
|
||||
id="radialGradient5031"
|
||||
xlink:href="#linearGradient5060"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" />
|
||||
<linearGradient
|
||||
id="linearGradient5060">
|
||||
<stop
|
||||
id="stop5062"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop5064"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="605.71429"
|
||||
cy="486.64789"
|
||||
r="117.14286"
|
||||
fx="605.71429"
|
||||
fy="486.64789"
|
||||
id="radialGradient5029"
|
||||
xlink:href="#linearGradient5060"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" />
|
||||
<linearGradient
|
||||
id="linearGradient5048">
|
||||
<stop
|
||||
id="stop5050"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop5056"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
offset="0.5" />
|
||||
<stop
|
||||
id="stop5052"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
x1="302.85715"
|
||||
y1="366.64789"
|
||||
x2="302.85715"
|
||||
y2="609.50507"
|
||||
id="linearGradient5027"
|
||||
xlink:href="#linearGradient5048"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" />
|
||||
<linearGradient
|
||||
id="linearGradient4542">
|
||||
<stop
|
||||
id="stop4544"
|
||||
style="stop-color:#000000;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop4546"
|
||||
style="stop-color:#000000;stop-opacity:0"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="24.306795"
|
||||
cy="42.07798"
|
||||
r="15.821514"
|
||||
fx="24.306795"
|
||||
fy="42.07798"
|
||||
id="radialGradient4548"
|
||||
xlink:href="#linearGradient4542"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.284916,0,30.08928)" />
|
||||
<linearGradient
|
||||
id="linearGradient15662">
|
||||
<stop
|
||||
id="stop15664"
|
||||
style="stop-color:#ffffff;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop15666"
|
||||
style="stop-color:#f8f8f8;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="64.567902"
|
||||
r="5.257"
|
||||
fx="20.892099"
|
||||
fy="64.567902"
|
||||
id="aigrd3"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
id="stop15573"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop15575"
|
||||
style="stop-color:#9a9a9a;stop-opacity:1"
|
||||
offset="1" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="114.5684"
|
||||
r="5.256"
|
||||
fx="20.892099"
|
||||
fy="114.5684"
|
||||
id="aigrd2"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
id="stop15566"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop15568"
|
||||
style="stop-color:#9a9a9a;stop-opacity:1"
|
||||
offset="1" />
|
||||
</radialGradient>
|
||||
<linearGradient
|
||||
id="linearGradient269">
|
||||
<stop
|
||||
id="stop270"
|
||||
style="stop-color:#a3a3a3;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop271"
|
||||
style="stop-color:#4c4c4c;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient259">
|
||||
<stop
|
||||
id="stop260"
|
||||
style="stop-color:#fafafa;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop261"
|
||||
style="stop-color:#bbbbbb;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient12512">
|
||||
<stop
|
||||
id="stop12513"
|
||||
style="stop-color:#ffffff;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop12517"
|
||||
style="stop-color:#fff520;stop-opacity:0.89108908"
|
||||
offset="0.5" />
|
||||
<stop
|
||||
id="stop12514"
|
||||
style="stop-color:#fff300;stop-opacity:0"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="8.824419"
|
||||
cy="3.7561285"
|
||||
r="37.751713"
|
||||
fx="8.824419"
|
||||
fy="3.7561285"
|
||||
id="radialGradient15656"
|
||||
xlink:href="#linearGradient269"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)" />
|
||||
<radialGradient
|
||||
cx="33.966679"
|
||||
cy="35.736916"
|
||||
r="86.70845"
|
||||
fx="33.966679"
|
||||
fy="35.736916"
|
||||
id="radialGradient15658"
|
||||
xlink:href="#linearGradient259"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.960493,0,0,1.041132,0.07464063,-48.138718)" />
|
||||
<radialGradient
|
||||
cx="8.1435566"
|
||||
cy="7.2678967"
|
||||
r="38.158695"
|
||||
fx="8.1435566"
|
||||
fy="7.2678967"
|
||||
id="radialGradient15668"
|
||||
xlink:href="#linearGradient15662"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)" />
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="114.5684"
|
||||
r="5.256"
|
||||
fx="20.892099"
|
||||
fy="114.5684"
|
||||
id="radialGradient2283"
|
||||
xlink:href="#aigrd2"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)" />
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="64.567902"
|
||||
r="5.257"
|
||||
fx="20.892099"
|
||||
fy="64.567902"
|
||||
id="radialGradient2285"
|
||||
xlink:href="#aigrd3"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)" />
|
||||
<linearGradient
|
||||
x1="18.971846"
|
||||
y1="14.452502"
|
||||
x2="44.524982"
|
||||
y2="41.792759"
|
||||
id="linearGradient4343"
|
||||
xlink:href="#linearGradient3377-76"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient3377-76">
|
||||
<stop
|
||||
id="stop3379-5"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop4345"
|
||||
style="stop-color:#fcb915;stop-opacity:1"
|
||||
offset="0.5" />
|
||||
<stop
|
||||
id="stop3381-7"
|
||||
style="stop-color:#c68708;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
x1="145.64697"
|
||||
y1="79.160103"
|
||||
x2="175.6825"
|
||||
y2="108.75008"
|
||||
id="linearGradient4349"
|
||||
xlink:href="#linearGradient3377-76"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient4482">
|
||||
<stop
|
||||
id="stop4484"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop4486"
|
||||
style="stop-color:#fcb915;stop-opacity:1"
|
||||
offset="0.5" />
|
||||
<stop
|
||||
id="stop4488"
|
||||
style="stop-color:#c68708;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="135.38333"
|
||||
cy="97.369568"
|
||||
r="19.467436"
|
||||
fx="135.38333"
|
||||
fy="97.369568"
|
||||
id="radialGradient4351"
|
||||
xlink:href="#linearGradient3377"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
|
||||
<linearGradient
|
||||
id="linearGradient3377">
|
||||
<stop
|
||||
id="stop3379"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop3381"
|
||||
style="stop-color:#ffaa00;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
cx="45.883327"
|
||||
cy="28.869568"
|
||||
r="19.467436"
|
||||
fx="45.883327"
|
||||
fy="28.869568"
|
||||
id="radialGradient4353"
|
||||
xlink:href="#linearGradient3377"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient4495">
|
||||
<stop
|
||||
id="stop4497"
|
||||
style="stop-color:#faff2b;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop4499"
|
||||
style="stop-color:#ffaa00;stop-opacity:1"
|
||||
offset="1" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Jakub Steiner</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:source>http://jimmac.musichall.cz</dc:source>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer6">
|
||||
<g
|
||||
transform="matrix(0.02165152,0,0,0.01485743,43.0076,42.68539)"
|
||||
id="g5022"
|
||||
style="display:inline">
|
||||
<rect
|
||||
width="1339.6335"
|
||||
height="478.35718"
|
||||
x="-1559.2523"
|
||||
y="-150.69685"
|
||||
id="rect4173"
|
||||
style="opacity:0.40206185;color:#000000;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
|
||||
<path
|
||||
d="m -219.61876,-150.68038 c 0,0 0,478.33079 0,478.33079 142.874166,0.90045 345.40022,-107.16966 345.40014,-239.196175 0,-132.026537 -159.436816,-239.134595 -345.40014,-239.134615 z"
|
||||
id="path5058"
|
||||
style="opacity:0.40206185;color:#000000;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
|
||||
<path
|
||||
d="m -1559.2523,-150.68038 c 0,0 0,478.33079 0,478.33079 -142.8742,0.90045 -345.4002,-107.16966 -345.4002,-239.196175 0,-132.026537 159.4368,-239.134595 345.4002,-239.134615 z"
|
||||
id="path5018"
|
||||
style="opacity:0.40206185;color:#000000;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="layer1"
|
||||
style="display:inline">
|
||||
<rect
|
||||
width="34.875"
|
||||
height="40.920494"
|
||||
rx="1.1490486"
|
||||
ry="1.1490486"
|
||||
x="6.6781936"
|
||||
y="-44.492271"
|
||||
transform="matrix(3.7443726e-4,0.9999999,-0.9999999,3.7443726e-4,0,0)"
|
||||
id="rect15391"
|
||||
style="color:#000000;fill:url(#radialGradient15658);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient15656);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
|
||||
<rect
|
||||
width="32.775887"
|
||||
height="38.946384"
|
||||
rx="0.14904857"
|
||||
ry="0.14904857"
|
||||
x="7.7406945"
|
||||
y="-43.554771"
|
||||
transform="matrix(3.7443726e-4,0.9999999,-0.9999999,3.7443726e-4,0,0)"
|
||||
id="rect15660"
|
||||
style="color:#000000;fill:none;stroke:url(#radialGradient15668);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible" />
|
||||
<g
|
||||
transform="matrix(3.7443726e-4,0.9999999,-0.9999999,3.7443726e-4,48.176974,0.7030484)"
|
||||
id="g2270">
|
||||
<g
|
||||
transform="matrix(0.229703,0,0,0.229703,4.967081,4.244972)"
|
||||
id="g1440"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4">
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="114.5684"
|
||||
r="5.256"
|
||||
fx="20.892099"
|
||||
fy="114.5684"
|
||||
id="radialGradient1442"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
id="stop1444"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop1446"
|
||||
style="stop-color:#474747;stop-opacity:1"
|
||||
offset="1" />
|
||||
</radialGradient>
|
||||
<path
|
||||
d="m 23.428,113.07 c 0,1.973 -1.6,3.572 -3.573,3.572 -1.974,0 -3.573,-1.6 -3.573,-3.572 0,-1.974 1.6,-3.573 3.573,-3.573 1.973,0 3.573,1.6 3.573,3.573 z"
|
||||
id="path1448"
|
||||
style="stroke:none" />
|
||||
<radialGradient
|
||||
cx="20.892099"
|
||||
cy="64.567902"
|
||||
r="5.257"
|
||||
fx="20.892099"
|
||||
fy="64.567902"
|
||||
id="radialGradient1450"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
id="stop1452"
|
||||
style="stop-color:#f0f0f0;stop-opacity:1"
|
||||
offset="0" />
|
||||
<stop
|
||||
id="stop1454"
|
||||
style="stop-color:#474747;stop-opacity:1"
|
||||
offset="1" />
|
||||
</radialGradient>
|
||||
<path
|
||||
d="m 23.428,63.07 c 0,1.973 -1.6,3.573 -3.573,3.573 -1.974,0 -3.573,-1.6 -3.573,-3.573 0,-1.974 1.6,-3.573 3.573,-3.573 1.973,0 3.573,1.6 3.573,3.573 z"
|
||||
id="path1456"
|
||||
style="stroke:none" />
|
||||
</g>
|
||||
<path
|
||||
d="m 9.9950109,29.952326 c 0,0.453204 -0.3675248,0.820499 -0.8207288,0.820499 -0.4534338,0 -0.8207289,-0.367524 -0.8207289,-0.820499 0,-0.453434 0.3675248,-0.820729 0.8207289,-0.820729 0.453204,0 0.8207288,0.367525 0.8207288,0.820729 z"
|
||||
id="path15570"
|
||||
style="fill:url(#radialGradient2283);fill-rule:nonzero;stroke:none" />
|
||||
<path
|
||||
d="m 9.9950109,18.467176 c 0,0.453204 -0.3675248,0.820729 -0.8207288,0.820729 -0.4534338,0 -0.8207289,-0.367525 -0.8207289,-0.820729 0,-0.453434 0.3675248,-0.820729 0.8207289,-0.820729 0.453204,0 0.8207288,0.367525 0.8207288,0.820729 z"
|
||||
id="path15577"
|
||||
style="fill:url(#radialGradient2285);fill-rule:nonzero;stroke:none" />
|
||||
</g>
|
||||
<path
|
||||
d="M 42.648774,11.564395 4.7421847,11.578589"
|
||||
id="path15672"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.98855311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.01754384" />
|
||||
<path
|
||||
d="M 43.122908,12.558495 5.105198,12.57273"
|
||||
id="path15674"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.20467828" />
|
||||
<g
|
||||
transform="matrix(0.93926906,0,0,0.93926906,1.7862503,0.15875288)"
|
||||
id="g4335"
|
||||
style="display:inline">
|
||||
<path
|
||||
d="m 57.818182,30.363636 a 26.181818,26.181818 0 1 1 -52.363636,0 26.181818,26.181818 0 1 1 52.363636,0 z"
|
||||
transform="matrix(0.32711652,0,0,0.32711652,21.318317,13.866206)"
|
||||
id="path2826"
|
||||
style="color:#000000;fill:url(#linearGradient4343);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:3.4430635;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<g
|
||||
transform="matrix(0.38647848,0,0,0.38647848,-43.81212,-10.696142)"
|
||||
id="g3618">
|
||||
<path
|
||||
d="m 152.88222,77.612314 -19.81441,7.17921 30.49556,4.148871 0.42548,35.773095 16.10976,-10.59033 0.57587,-34.384848 -27.79226,-2.125998 z"
|
||||
id="rect3522"
|
||||
style="fill:url(#linearGradient4349);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 133.33785,84.998317 30.70884,3.365615 0,36.477188 -31.12383,-5.06478 0.41499,-34.778023 z"
|
||||
id="rect3520"
|
||||
style="fill:url(#radialGradient4351);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 163.81279,88.408895 16.72598,-8.4088"
|
||||
id="path3536"
|
||||
style="fill:url(#radialGradient4353);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
</g>
|
||||
</g>
|
||||
<rect
|
||||
width="34.204628"
|
||||
height="24.651224"
|
||||
rx="2.1830378"
|
||||
ry="1.9372574"
|
||||
x="6.7956791"
|
||||
y="12.61764"
|
||||
id="rect2221"
|
||||
style="fill:none;stroke:#000000;stroke-width:2.54764795;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:7.64294409, 2.54764803;stroke-dashoffset:6.87864969" />
|
||||
</g>
|
||||
<g
|
||||
id="layer4"
|
||||
style="display:inline" />
|
||||
</svg>
|
After Width: | Height: | Size: 18 KiB |
|
@ -14,7 +14,7 @@
|
|||
height="48.000000px"
|
||||
id="svg249"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="techdraw-viewsection.svg"
|
||||
inkscape:export-filename="/home/jimmac/gfx/novell/pdes/trunk/docs/BIGmime-text.png"
|
||||
inkscape:export-xdpi="240.00000"
|
||||
|
@ -361,36 +361,6 @@
|
|||
fx="45.883327"
|
||||
fy="28.869568"
|
||||
r="19.467436" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3377-76"
|
||||
id="linearGradient4355"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="145.64697"
|
||||
y1="79.160103"
|
||||
x2="175.6825"
|
||||
y2="108.75008" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient4357"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)"
|
||||
cx="135.38333"
|
||||
cy="97.369568"
|
||||
fx="135.38333"
|
||||
fy="97.369568"
|
||||
r="19.467436" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient4359"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="45.883327"
|
||||
cy="28.869568"
|
||||
fx="45.883327"
|
||||
fy="28.869568"
|
||||
r="19.467436" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
|
@ -399,9 +369,9 @@
|
|||
borderopacity="0.32941176"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="16.11411"
|
||||
inkscape:cy="28.367008"
|
||||
inkscape:zoom="12.756206"
|
||||
inkscape:cx="23.749968"
|
||||
inkscape:cy="21.142228"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
|
@ -420,7 +390,7 @@
|
|||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:title />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Jakub Steiner</dc:title>
|
||||
|
@ -594,29 +564,30 @@
|
|||
id="rect2221"
|
||||
width="31.612995"
|
||||
height="22.113316"
|
||||
x="7.2478685"
|
||||
y="15.429372"
|
||||
x="7.6014218"
|
||||
y="14.98743"
|
||||
rx="2.0176325"
|
||||
ry="1.7378116" />
|
||||
<g
|
||||
transform="matrix(0.21559025,0,0,0.36300728,-2.8500371,-9.3432923)"
|
||||
id="g4347">
|
||||
id="g4347"
|
||||
style="fill:#d3d7cf;stroke:#888a85">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
id="path4349"
|
||||
d="m 152.88222,77.612314 -19.81441,7.17921 30.49556,4.148871 0.42548,35.773095 16.10976,-10.59033 0.57587,-34.384848 -27.79226,-2.125998 z"
|
||||
style="fill:url(#linearGradient4355);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
style="fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:2.91421914000000015;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path4351"
|
||||
d="m 133.33785,84.998317 30.70884,3.365615 0,36.477188 -31.12383,-5.06478 0.41499,-34.778023 z"
|
||||
style="fill:url(#radialGradient4357);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
style="fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:2.91421914000000015;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path4353"
|
||||
d="m 163.81279,88.408895 16.72598,-8.4088"
|
||||
style="fill:url(#radialGradient4359);fill-opacity:1;fill-rule:evenodd;stroke:#7b5600;stroke-width:2.91421914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
style="fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:2.91421914000000015;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<path
|
||||
|
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
|
@ -54,9 +54,9 @@ using namespace TechDraw;
|
|||
using namespace TechDrawGui;
|
||||
|
||||
|
||||
TaskLinkDim::TaskLinkDim(Part::Feature* part, std::vector<std::string>& subs, TechDraw::DrawPage* page) :
|
||||
TaskLinkDim::TaskLinkDim(std::vector<App::DocumentObject*> parts, std::vector<std::string>& subs, TechDraw::DrawPage* page) :
|
||||
ui(new Ui_TaskLinkDim),
|
||||
m_part(part),
|
||||
m_parts(parts),
|
||||
m_subs(subs),
|
||||
m_page(page)
|
||||
{
|
||||
|
@ -71,11 +71,16 @@ TaskLinkDim::TaskLinkDim(Part::Feature* part, std::vector<std::string>& subs, Te
|
|||
|
||||
loadAvailDims();
|
||||
|
||||
ui->leFeature->setText(QString::fromStdString(part->getNameInDocument()));
|
||||
ui->leFeature1->setText(QString::fromStdString(parts.at(0)->getNameInDocument()));
|
||||
ui->leGeometry1->setText(QString::fromStdString(subs.at(0)));
|
||||
|
||||
if (subs.size() > 1) {
|
||||
ui->leGeometry2->setText(QString::fromStdString(subs.at(1)));
|
||||
if (parts.at(0)->getNameInDocument() != parts.at(1)->getNameInDocument()) {
|
||||
ui->leFeature2->setText(QString::fromStdString(parts.at(1)->getNameInDocument()));
|
||||
} else {
|
||||
ui->leFeature2->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,26 +154,37 @@ bool TaskLinkDim::dimReferencesSelection(const TechDraw::DrawViewDimension* dim)
|
|||
return result;
|
||||
}
|
||||
|
||||
Part::Feature* refPart = static_cast<Part::Feature*>(dim->References3D.getValues().at(0));
|
||||
//Part::Feature* refPart = static_cast<Part::Feature*>(dim->References3D.getValues().at(0));
|
||||
std::vector<Part::Feature*> refParts;
|
||||
std::vector<App::DocumentObject*> docObjs = dim->References3D.getValues();
|
||||
for (auto& d: docObjs) {
|
||||
Part::Feature* part = static_cast<Part::Feature*>(d);
|
||||
refParts.push_back(part);
|
||||
}
|
||||
std::vector<std::string> refSubs = dim->References3D.getSubValues();
|
||||
if (refPart == m_part) {
|
||||
if (refSubs.size() == m_subs.size()) {
|
||||
if (m_subs.size() == 0) {
|
||||
//we're done. why did we get here?
|
||||
} else if (refSubs.size() == 1) {
|
||||
if (refSubs[0] == m_subs[0]) {
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
if ( ((refSubs[0] == m_subs[0]) &&
|
||||
(refSubs[1] == m_subs[1])) ||
|
||||
((refSubs[0] == m_subs[1]) &&
|
||||
(refSubs[1] == m_subs[0])) ) {
|
||||
result = true;
|
||||
}
|
||||
if (refParts.size() == m_parts.size()) {
|
||||
if(refParts.size() == 0) {
|
||||
//shouldn't happen!
|
||||
} else if (refParts.size() == 1) {
|
||||
if ((refParts[0] == m_parts[0]) &&
|
||||
(refSubs[0] == m_subs[0]) ) { //everything matches
|
||||
result = true;
|
||||
}
|
||||
} else if (refParts.size() == 2) {
|
||||
if (( (refParts[0] == m_parts[0]) &&
|
||||
(refParts[1] == m_parts[1]) ) &&
|
||||
( (refSubs[0] == m_subs[0]) &&
|
||||
(refSubs[1] == m_subs[1]) ) ) {
|
||||
result = true;
|
||||
} else if (( (refParts[0] == m_parts[1]) &&
|
||||
(refParts[1] == m_parts[0]) ) &&
|
||||
( (refSubs[0] == m_subs[1]) &&
|
||||
(refSubs[1] == m_subs[0]) ) ) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -182,11 +198,11 @@ void TaskLinkDim::updateDims()
|
|||
QString name = child->data(0, Qt::UserRole).toString();
|
||||
App::DocumentObject* obj = m_page->getDocument()->getObject(name.toStdString().c_str());
|
||||
TechDraw::DrawViewDimension* dim = dynamic_cast<TechDraw::DrawViewDimension*>(obj);
|
||||
std::vector<App::DocumentObject*> parts;
|
||||
for (unsigned int iPart = 0; iPart < m_subs.size(); iPart++) {
|
||||
parts.push_back(m_part);
|
||||
}
|
||||
dim->References3D.setValues(parts,m_subs);
|
||||
// std::vector<App::DocumentObject*> parts;
|
||||
// for (unsigned int iPart = 0; iPart < m_subs.size(); iPart++) {
|
||||
// parts.push_back(m_part);
|
||||
// }
|
||||
dim->References3D.setValues(m_parts,m_subs);
|
||||
std::string DimName = dim->getNameInDocument();
|
||||
std::string measureType = "True";
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.MeasureType = \'%s\'",
|
||||
|
@ -204,8 +220,8 @@ void TaskLinkDim::updateDims()
|
|||
std::string DimName = dim->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.MeasureType = \'%s\'",
|
||||
DimName.c_str(),measureType.c_str());
|
||||
dim->References3D.setValue(0,""); //set this property to "empty"
|
||||
//dim->MeasureType.setValue("Projected");
|
||||
dim->References3D.setValue(0,""); //DVD.References3D
|
||||
dim->clear3DMeasurements(); //DVD.measurement.References3D
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,10 +272,10 @@ void TaskLinkDim::changeEvent(QEvent *e)
|
|||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
TaskDlgLinkDim::TaskDlgLinkDim(Part::Feature* part,std::vector<std::string>& subs, TechDraw::DrawPage* page) :
|
||||
TaskDlgLinkDim::TaskDlgLinkDim(std::vector<App::DocumentObject*> parts,std::vector<std::string>& subs, TechDraw::DrawPage* page) :
|
||||
TaskDialog()
|
||||
{
|
||||
widget = new TaskLinkDim(part,subs,page);
|
||||
widget = new TaskLinkDim(parts,subs,page);
|
||||
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("TechDraw_Dimension_Link"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
|
|
|
@ -45,7 +45,7 @@ class TaskLinkDim : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskLinkDim(Part::Feature* part,std::vector<std::string>& subs, TechDraw::DrawPage* page);
|
||||
TaskLinkDim(std::vector<App::DocumentObject*> parts,std::vector<std::string>& subs, TechDraw::DrawPage* page);
|
||||
~TaskLinkDim();
|
||||
|
||||
public:
|
||||
|
@ -64,8 +64,8 @@ protected:
|
|||
|
||||
private:
|
||||
Ui_TaskLinkDim * ui;
|
||||
Part::Feature* m_part;
|
||||
std::vector<std::string> m_subs;
|
||||
const std::vector<App::DocumentObject*> m_parts;
|
||||
const std::vector<std::string> m_subs;
|
||||
TechDraw::DrawPage* m_page;
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ class TaskDlgLinkDim : public Gui::TaskView::TaskDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgLinkDim(Part::Feature* part,std::vector<std::string>& subs, TechDraw::DrawPage* page);
|
||||
TaskDlgLinkDim(std::vector<App::DocumentObject*> parts,std::vector<std::string>& subs, TechDraw::DrawPage* page);
|
||||
~TaskDlgLinkDim();
|
||||
|
||||
public:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>342</width>
|
||||
<height>430</height>
|
||||
<width>400</width>
|
||||
<height>472</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -61,7 +61,7 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="leGeometry2">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
|
@ -74,10 +74,43 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblGeometry">
|
||||
<property name="text">
|
||||
<string>Geometry:</string>
|
||||
<string>Feature2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="leFeature2">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(120, 120, 120);</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leFeature1">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(120, 120, 120);</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblFeature">
|
||||
<property name="text">
|
||||
<string>Feature1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -94,23 +127,17 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leFeature">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(120, 120, 120);</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Geometry1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblFeature">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Feature:</string>
|
||||
<string>Geometry2: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
87
src/Mod/TechDraw/Gui/ViewProviderImage.cpp
Normal file
87
src/Mod/TechDraw/Gui/ViewProviderImage.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
#include "ViewProviderImage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderImage, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
ViewProviderImage::ViewProviderImage()
|
||||
{
|
||||
sPixmap = "actions/techdraw-image";
|
||||
}
|
||||
|
||||
ViewProviderImage::~ViewProviderImage()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderImage::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
// call parent attach method
|
||||
ViewProviderDrawingView::attach(pcFeat);
|
||||
}
|
||||
|
||||
void ViewProviderImage::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
ViewProviderDrawingView::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderImage::getDisplayModes(void) const
|
||||
{
|
||||
// get the modes of the father
|
||||
std::vector<std::string> StrList = ViewProviderDrawingView::getDisplayModes();
|
||||
|
||||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderImage::updateData(const App::Property* prop)
|
||||
{
|
||||
ViewProviderDrawingView::updateData(prop);
|
||||
}
|
||||
|
||||
TechDraw::DrawViewImage* ViewProviderImage::getViewObject() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawViewImage*>(pcObject);
|
||||
}
|
||||
|
||||
|
59
src/Mod/TechDraw/Gui/ViewProviderImage.h
Normal file
59
src/Mod/TechDraw/Gui/ViewProviderImage.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2016 WandererFan (wandererfan@gmail.com) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef DRAWINGGUI_VIEWPROVIDERIMAGE_H
|
||||
#define DRAWINGGUI_VIEWPROVIDERIMAGE_H
|
||||
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderImage : public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderImage);
|
||||
|
||||
public:
|
||||
/// constructor
|
||||
ViewProviderImage();
|
||||
/// destructor
|
||||
virtual ~ViewProviderImage();
|
||||
|
||||
|
||||
virtual void attach(App::DocumentObject *);
|
||||
virtual void setDisplayMode(const char* ModeName);
|
||||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
|
||||
virtual TechDraw::DrawViewImage* getViewObject() const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERIMAGE_H
|
|
@ -37,6 +37,7 @@
|
|||
#include <App/DocumentObject.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawViewDimension.h>
|
||||
#include <Mod/TechDraw/App/DrawViewMulti.h>
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
|
||||
#include<Mod/TechDraw/App/DrawPage.h>
|
||||
|
@ -87,6 +88,11 @@ void ViewProviderViewPart::onChanged(const App::Property* prop)
|
|||
|
||||
void ViewProviderViewPart::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
TechDraw::DrawViewMulti* dvm = dynamic_cast<TechDraw::DrawViewMulti*>(pcFeat);
|
||||
if (dvm != nullptr) {
|
||||
sPixmap = "TechDraw_Tree_Multi";
|
||||
}
|
||||
|
||||
// call parent attach method
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
*draw << "TechDraw_NewPageDef";
|
||||
*draw << "TechDraw_NewPage";
|
||||
*draw << "TechDraw_NewView";
|
||||
*draw << "TechDraw_NewMulti";
|
||||
*draw << "TechDraw_ProjGroup";
|
||||
*draw << "TechDraw_NewViewSection";
|
||||
*draw << "TechDraw_Annotation";
|
||||
|
@ -75,6 +76,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
*draw << "TechDraw_DraftView";
|
||||
*draw << "TechDraw_ArchView";
|
||||
*draw << "TechDraw_ExportPage";
|
||||
*draw << "TechDraw_Image";
|
||||
//*draw << "TechDraw_Open";
|
||||
//*part << "TechDraw_NewA3Landscape";
|
||||
//*part << "TechDraw_OpenBrowserView";
|
||||
|
@ -96,6 +98,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
Gui::ToolBarItem *views = new Gui::ToolBarItem(root);
|
||||
views->setCommand("TechDraw Views");
|
||||
*views << "TechDraw_NewView";
|
||||
*views << "TechDraw_NewMulti";
|
||||
*views << "TechDraw_ProjGroup";
|
||||
*views << "TechDraw_NewViewSection";
|
||||
*views << "TechDraw_Annotation";
|
||||
|
@ -128,6 +131,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
|
||||
decor->setCommand("TechDraw Decoration");
|
||||
*decor << "TechDraw_NewHatch";
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
return root;
|
||||
}
|
||||
|
@ -143,6 +147,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
|||
Gui::ToolBarItem *views = new Gui::ToolBarItem(root);
|
||||
views->setCommand("Views");
|
||||
*views << "TechDraw_NewView";
|
||||
*views << "TechDraw_NewMulti";
|
||||
*views << "TechDraw_ProjGroup";
|
||||
*views << "TechDraw_NewViewSection";
|
||||
*views << "TechDraw_Annotation";
|
||||
|
@ -174,6 +179,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
|||
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
|
||||
decor->setCommand("TechDraw Decoration");
|
||||
*decor << "TechDraw_NewHatch";
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
|
||||
return root;
|
||||
|
|
Loading…
Reference in New Issue
Block a user