Initial version addCosmeticVertex
@@ -123,6 +123,8 @@ SET(Geometry_SRCS
|
||||
Geometry.h
|
||||
GeometryObject.cpp
|
||||
GeometryObject.h
|
||||
Cosmetic.cpp
|
||||
Cosmetic.h
|
||||
)
|
||||
|
||||
SET(Python_SRCS
|
||||
|
||||
143
src/Mod/TechDraw/App/Cosmetic.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
|
||||
#include "Cosmetic.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
CosmeticVertex::CosmeticVertex()
|
||||
{
|
||||
pageLocation = Base::Vector3d(0.0, 0.0, 0.0);
|
||||
modelLocation = Base::Vector3d(0.0, 0.0, 0.0);
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x00000000));
|
||||
|
||||
linkGeom = -1;
|
||||
color = fcColor;
|
||||
size = 3.0;
|
||||
style = 1;
|
||||
visible = true;
|
||||
}
|
||||
|
||||
CosmeticVertex::CosmeticVertex(Base::Vector3d loc)
|
||||
{
|
||||
pageLocation = loc;
|
||||
modelLocation = loc;
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0xff000000));
|
||||
|
||||
linkGeom = -1;
|
||||
color = fcColor;
|
||||
//TODO: size = hGrp->getFloat("VertexSize",30.0);
|
||||
size = 30.0;
|
||||
style = 1; //TODO: implement styled vertexes
|
||||
visible = true;
|
||||
}
|
||||
|
||||
std::string CosmeticVertex::toCSV(void) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << pageLocation.x << "," <<
|
||||
pageLocation.y << "," <<
|
||||
pageLocation.z << "," <<
|
||||
|
||||
modelLocation.x << "," <<
|
||||
modelLocation.y << "," <<
|
||||
modelLocation.z << "," <<
|
||||
|
||||
linkGeom << "," <<
|
||||
color.asHexString() << "," <<
|
||||
size << "," <<
|
||||
style << "," <<
|
||||
visible <<
|
||||
std::endl;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool CosmeticVertex::fromCSV(std::string& lineSpec)
|
||||
{
|
||||
unsigned int maxCells = 11;
|
||||
if (lineSpec.length() == 0) {
|
||||
Base::Console().Message( "CosmeticVertex::fromCSV - lineSpec empty\n");
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> values = split(lineSpec);
|
||||
Base::Console().Message("CV::fromCSV - values: %d\n",values.size());
|
||||
if (values.size() < maxCells) {
|
||||
Base::Console().Message( "CosmeticVertex::fromCSV(%s) invalid CSV entry\n",lineSpec.c_str() );
|
||||
return false;
|
||||
}
|
||||
double x = atof(values[0].c_str());
|
||||
double y = atof(values[1].c_str());
|
||||
double z = atof(values[2].c_str());
|
||||
pageLocation = Base::Vector3d (x,y,z);
|
||||
x = atof(values[3].c_str());
|
||||
y = atof(values[4].c_str());
|
||||
z = atof(values[5].c_str());
|
||||
modelLocation = Base::Vector3d (x,y,z);
|
||||
linkGeom = atoi(values[6].c_str());
|
||||
color.fromHexString(values[7]);
|
||||
size = atof(values[8].c_str());
|
||||
style = atoi(values[9].c_str());
|
||||
visible = atoi(values[10].c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> CosmeticVertex::split(std::string csvLine)
|
||||
{
|
||||
Base::Console().Message("CV::split - csvLine: %s\n",csvLine.c_str());
|
||||
std::vector<std::string> result;
|
||||
std::stringstream lineStream(csvLine);
|
||||
std::string cell;
|
||||
|
||||
while(std::getline(lineStream,cell, ','))
|
||||
{
|
||||
result.push_back(cell);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void CosmeticVertex::dump(char* title)
|
||||
{
|
||||
Base::Console().Message("CV::dump - %s \n",title);
|
||||
Base::Console().Message("CV::dump - %s \n",toCSV().c_str());
|
||||
}
|
||||
|
||||
58
src/Mod/TechDraw/App/Cosmetic.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 TECHDRAW_COSMETIC_H
|
||||
#define TECHDRAW_COSMETIC_H
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
#include <App/Material.h>
|
||||
|
||||
namespace TechDraw {
|
||||
|
||||
class TechDrawExport CosmeticVertex
|
||||
{
|
||||
public:
|
||||
CosmeticVertex();
|
||||
CosmeticVertex(Base::Vector3d loc);
|
||||
virtual ~CosmeticVertex() = default;
|
||||
|
||||
std::string toCSV(void) const;
|
||||
bool fromCSV(std::string& lineSpec);
|
||||
void dump(char* title);
|
||||
|
||||
Base::Vector3d pageLocation;
|
||||
Base::Vector3d modelLocation;
|
||||
int linkGeom; //connection to corresponding "real" Vertex
|
||||
App::Color color;
|
||||
double size;
|
||||
int style;
|
||||
bool visible;
|
||||
|
||||
protected:
|
||||
std::vector<std::string> split(std::string csvLine);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} //end namespace TechDraw
|
||||
|
||||
#endif //TECHDRAW_COSMETIC_H
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include "DrawView.h"
|
||||
#include "DrawPage.h"
|
||||
#include "DrawViewCollection.h"
|
||||
#include "DrawViewClip.h"
|
||||
@@ -47,11 +46,15 @@
|
||||
#include "DrawProjGroupItem.h"
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "Geometry.h"
|
||||
#include "Cosmetic.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawViewPy.h> // generated from DrawViewPy.xml
|
||||
|
||||
using namespace TechDraw;
|
||||
#include "DrawView.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGeometry;
|
||||
|
||||
//===========================================================================
|
||||
// DrawView
|
||||
@@ -323,12 +326,6 @@ std::vector<TechDraw::DrawLeaderLine*> DrawView::getLeaders() const
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawView::addRandomVertex(Base::Vector3d pos)
|
||||
{
|
||||
(void) pos;
|
||||
Base::Console().Message("DV::addRandomVertex()\n");
|
||||
}
|
||||
|
||||
void DrawView::Restore(Base::XMLReader &reader)
|
||||
{
|
||||
// this is temporary code for backwards compat (within v0.17). can probably be deleted once there are no development
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace TechDraw
|
||||
class DrawPage;
|
||||
class DrawViewClip;
|
||||
class DrawLeaderLine;
|
||||
class CosmeticVertex;
|
||||
|
||||
/** Base class of all View Features in the drawing module
|
||||
*/
|
||||
@@ -90,8 +91,8 @@ public:
|
||||
void requestPaint(void);
|
||||
virtual void handleXYLock(void);
|
||||
virtual bool isLocked(void) const;
|
||||
virtual void addRandomVertex(Base::Vector3d pos);
|
||||
std::vector<TechDraw::DrawLeaderLine*> getLeaders() const;
|
||||
|
||||
std::vector<TechDraw::DrawLeaderLine*> getLeaders(void) const;
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
#include "DrawPage.h"
|
||||
#include "EdgeWalker.h"
|
||||
#include "LineGroup.h"
|
||||
|
||||
#include "Cosmetic.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawViewPartPy.h> // generated from DrawViewPartPy.xml
|
||||
|
||||
@@ -117,7 +117,9 @@ using namespace std;
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewPart, TechDraw::DrawView)
|
||||
|
||||
DrawViewPart::DrawViewPart(void) : geometryObject(0)
|
||||
DrawViewPart::DrawViewPart(void) :
|
||||
geometryObject(0),
|
||||
on1(true)
|
||||
{
|
||||
static const char *group = "Projection";
|
||||
static const char *sgroup = "HLR Parameters";
|
||||
@@ -148,8 +150,16 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0)
|
||||
ADD_PROPERTY_TYPE(IsoHidden ,(false),sgroup,App::Prop_None,"Hidden Iso u,v lines on/off");
|
||||
ADD_PROPERTY_TYPE(IsoCount ,(0),sgroup,App::Prop_None,"Number of isoparameters");
|
||||
|
||||
ADD_PROPERTY_TYPE(CosmeticVertexList ,(""),sgroup,App::Prop_None,"CosmeticVertex Save/Restore");
|
||||
|
||||
geometryObject = nullptr;
|
||||
getRunControl();
|
||||
|
||||
// Base::Vector3d org(0.0,0.0,0.0); //App side coords
|
||||
// addRandomVertex(org);
|
||||
// Base::Vector3d pt(11.0,11.0,0.0);
|
||||
// addRandomVertex(pt);
|
||||
|
||||
}
|
||||
|
||||
DrawViewPart::~DrawViewPart()
|
||||
@@ -279,6 +289,13 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
if (!keepUpdated()) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
//this is ghastly! but no convenient method for "object ready"
|
||||
if (on1) {
|
||||
rebuildCosmoVertex();
|
||||
on1 = false;
|
||||
}
|
||||
|
||||
App::Document* doc = getDocument();
|
||||
bool isRestoring = doc->testStatus(App::Document::Status::Restoring);
|
||||
const std::vector<App::DocumentObject*>& links = Source.getValues();
|
||||
@@ -324,6 +341,13 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
Rotation.getValue());
|
||||
}
|
||||
geometryObject = buildGeometryObject(mirroredShape,viewAxis);
|
||||
//add back the cosmetic vertices
|
||||
Base::Console().Message("DVP::execute - cosmoVertex: %d \n",cosmoVertex.size());
|
||||
for (auto& v: cosmoVertex) {
|
||||
Base::Console().Message("DVP::execute - adding random vertex\n");
|
||||
int idx = geometryObject->addRandomVertex(v->pageLocation * getScale());
|
||||
v->linkGeom = idx;
|
||||
}
|
||||
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
@@ -380,7 +404,6 @@ short DrawViewPart::mustExecute() const
|
||||
void DrawViewPart::onChanged(const App::Property* prop)
|
||||
{
|
||||
DrawView::onChanged(prop);
|
||||
|
||||
//TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.
|
||||
}
|
||||
|
||||
@@ -867,10 +890,34 @@ bool DrawViewPart::showSectionEdges(void)
|
||||
return m_sectionEdges;
|
||||
}
|
||||
|
||||
//build cosmoVertex from CosmeticVertexList
|
||||
void DrawViewPart::rebuildCosmoVertex(void)
|
||||
{
|
||||
Base::Console().Message("DVP::rebuildCosmoVertx()\n");
|
||||
cosmoVertex.clear();
|
||||
std::vector<std::string> restoreVerts = CosmeticVertexList.getValues();
|
||||
Base::Console().Message("DVP::rebuildCosmoVertex - verts in: %d \n",restoreVerts.size());
|
||||
for (auto& rv: restoreVerts) {
|
||||
if (!rv.empty()) {
|
||||
CosmeticVertex* cv = new CosmeticVertex();
|
||||
bool rc = cv->fromCSV(rv);
|
||||
if (rc) {
|
||||
// int idx = geometryObject->addRandomVertex(cv->pageLocation * getScale());
|
||||
// cv->linkGeom = idx;
|
||||
cosmoVertex.push_back(cv);
|
||||
} else {
|
||||
delete cv;
|
||||
}
|
||||
}
|
||||
}
|
||||
Base::Console().Message("DVP::rebuildCosmoVertex - cosmoVertexs: %d \n",cosmoVertex.size());
|
||||
}
|
||||
|
||||
//! remove features that are useless without this DVP
|
||||
//! hatches, geomhatches, dimensions,...
|
||||
void DrawViewPart::unsetupObject()
|
||||
{
|
||||
Base::Console().Message("DVP::unsetupObject()\n");
|
||||
nowUnsetting = true;
|
||||
App::Document* doc = getDocument();
|
||||
std::string docName = doc->getName();
|
||||
@@ -924,7 +971,6 @@ void DrawViewPart::unsetupObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! is this an Isometric projection?
|
||||
@@ -939,6 +985,67 @@ bool DrawViewPart::isIso(void) const
|
||||
return result;
|
||||
}
|
||||
|
||||
//********
|
||||
//* Cosmetics
|
||||
//********
|
||||
|
||||
// adds a cosmetic vertex to cosmoVertex and CosmeticVertexList
|
||||
int DrawViewPart::addRandomVertex(Base::Vector3d pos)
|
||||
{
|
||||
// Base::Console().Message("DVP::addRandomVertex(%s)\n", DrawUtil::formatVector(pos).c_str());
|
||||
int newIdx = -1;
|
||||
TechDraw::CosmeticVertex* rVert = new TechDraw::CosmeticVertex(pos);
|
||||
cosmoVertex.push_back(rVert);
|
||||
|
||||
//stuff stringList
|
||||
std::vector<std::string> saveVerts;
|
||||
const std::vector<TechDraw::CosmeticVertex*> cosVerts = getCosmeticVertex();
|
||||
for (auto& cv: cosVerts) {
|
||||
std::string csv = cv->toCSV();
|
||||
saveVerts.push_back(csv);
|
||||
}
|
||||
CosmeticVertexList.setValues(saveVerts);
|
||||
Base::Console().Message("DVP::addRandomVertex - saveVerts: %d \n",saveVerts.size());
|
||||
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
TechDraw::CosmeticVertex* DrawViewPart::getCosmeticVertexByIndex(int idx) const
|
||||
{
|
||||
// Base::Console().Message("DVP::getCosmeticVertexByIndex(%d)\n", idx);
|
||||
int cosmoOffset = 1000;
|
||||
int realIdx = idx - cosmoOffset;
|
||||
CosmeticVertex* result = nullptr;
|
||||
const std::vector<TechDraw::CosmeticVertex*> verts = getCosmeticVertex();
|
||||
if ((unsigned) realIdx < verts.size()) {
|
||||
result = verts.at(realIdx);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//find the cosmetic vertex corresponding to geometry vertex idx
|
||||
TechDraw::CosmeticVertex* DrawViewPart::getCosmeticVertexByLink(int idx) const
|
||||
{
|
||||
// Base::Console().Message("DVP::getVosmeticVertexByLinkIndex(%d)\n", idx);
|
||||
CosmeticVertex* result = nullptr;
|
||||
const std::vector<TechDraw::CosmeticVertex*> verts = getCosmeticVertex();
|
||||
for (auto& cv: verts) {
|
||||
if (cv->linkGeom == idx) {
|
||||
result = cv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawViewPart::clearCV(void)
|
||||
{
|
||||
Base::Console().Message("DVP::clearCV()\n");
|
||||
cosmoVertex.clear();
|
||||
std::vector<std::string> noVerts;
|
||||
CosmeticVertexList.setValues(noVerts);
|
||||
}
|
||||
|
||||
PyObject *DrawViewPart::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
|
||||
@@ -68,6 +68,7 @@ class DrawProjectSplit;
|
||||
class DrawViewSection;
|
||||
class DrawViewDetail;
|
||||
class DrawViewBalloon;
|
||||
class CosmeticVertex;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
@@ -101,6 +102,8 @@ public:
|
||||
App::PropertyBool IsoHidden;
|
||||
App::PropertyInteger IsoCount;
|
||||
|
||||
App::PropertyStringList CosmeticVertexList;
|
||||
|
||||
std::vector<TechDraw::DrawHatch*> getHatches(void) const;
|
||||
std::vector<TechDraw::DrawGeomHatch*> getGeomHatches(void) const;
|
||||
std::vector<TechDraw::DrawViewDimension*> getDimensions() const;
|
||||
@@ -136,7 +139,7 @@ public:
|
||||
const bool flip=true) const;
|
||||
|
||||
virtual short mustExecute() const;
|
||||
/* virtual void onDocumentRestored() override;*/
|
||||
// virtual void onDocumentRestored() override;
|
||||
|
||||
bool handleFaces(void);
|
||||
bool showSectionEdges(void);
|
||||
@@ -162,6 +165,12 @@ public:
|
||||
virtual TopoDS_Shape getSourceShapeFused(void) const;
|
||||
bool isIso(void) const;
|
||||
|
||||
virtual int addRandomVertex(Base::Vector3d pos);
|
||||
const std::vector<TechDraw::CosmeticVertex*> & getCosmeticVertex(void) const { return cosmoVertex; }
|
||||
TechDraw::CosmeticVertex* getCosmeticVertexByIndex(int idx) const;
|
||||
TechDraw::CosmeticVertex* getCosmeticVertexByLink(int idx) const;
|
||||
void clearCV(void);
|
||||
|
||||
protected:
|
||||
TechDrawGeometry::GeometryObject *geometryObject;
|
||||
Base::BoundBox3d bbox;
|
||||
@@ -183,8 +192,13 @@ protected:
|
||||
bool m_sectionEdges;
|
||||
bool m_handleFaces;
|
||||
|
||||
//Cosmetics
|
||||
std::vector<TechDraw::CosmeticVertex*> cosmoVertex;
|
||||
void rebuildCosmoVertex(void);
|
||||
|
||||
private:
|
||||
bool nowUnsetting;
|
||||
bool on1;
|
||||
/* bool m_restoreComplete;*/
|
||||
|
||||
};
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for creating and manipulating Technical Drawing Part Views</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="clearCV">
|
||||
<Documentation>
|
||||
<UserDocu>clearCV() - remove all CosmeticVertices from the View. Returns nothing.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -15,6 +15,14 @@ std::string DrawViewPartPy::representation(void) const
|
||||
return std::string("<DrawViewPart object>");
|
||||
}
|
||||
|
||||
PyObject* DrawViewPartPy::clearCV(PyObject *args)
|
||||
{
|
||||
(void) args;
|
||||
DrawViewPart* item = getDrawViewPartPtr();
|
||||
item->clearCV();
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject *DrawViewPartPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
|
||||
@@ -67,11 +67,14 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools2D.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include <Mod/Part/App/Geometry.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
|
||||
#include "Geometry.h"
|
||||
#include "DrawUtil.h"
|
||||
|
||||
using namespace TechDrawGeometry;
|
||||
using namespace TechDraw;
|
||||
@@ -955,3 +958,5 @@ BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -472,6 +472,15 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
||||
} //end TopExp
|
||||
}
|
||||
|
||||
int GeometryObject::addRandomVertex(Base::Vector3d pos)
|
||||
{
|
||||
// Base::Console().Message("GO::addRandomVertex(%s)\n",DrawUtil::formatVector(pos).c_str());
|
||||
TechDrawGeometry::Vertex* v = new TechDrawGeometry::Vertex(pos.x, - pos.y);
|
||||
vertexGeom.push_back(v);
|
||||
int idx = vertexGeom.size() - 1;
|
||||
return idx;
|
||||
}
|
||||
|
||||
//! empty Face geometry
|
||||
void GeometryObject::clearFaceGeom()
|
||||
{
|
||||
|
||||
@@ -125,6 +125,9 @@ public:
|
||||
TopoDS_Shape getHidSeam(void) { return hidSeam; }
|
||||
TopoDS_Shape getHidIso(void) { return hidIso; }
|
||||
|
||||
int addRandomVertex(Base::Vector3d pos);
|
||||
|
||||
|
||||
protected:
|
||||
//HLR output
|
||||
TopoDS_Shape visHard;
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
void CreateTechDrawCommands(void);
|
||||
void CreateTechDrawCommandsDims(void);
|
||||
void CreateTechDrawCommandsDecorate(void);
|
||||
void CreateTechDrawCommandsAnnotate(void);
|
||||
|
||||
void loadTechDrawResource()
|
||||
{
|
||||
@@ -108,6 +109,7 @@ PyMOD_INIT_FUNC(TechDrawGui)
|
||||
CreateTechDrawCommands();
|
||||
CreateTechDrawCommandsDims();
|
||||
CreateTechDrawCommandsDecorate();
|
||||
CreateTechDrawCommandsAnnotate();
|
||||
|
||||
TechDrawGui::Workbench::init();
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ set(TechDrawGui_MOC_HDRS
|
||||
TaskGeomHatch.h
|
||||
TaskLeaderLine.h
|
||||
TaskRichAnno.h
|
||||
TaskCosVertex.h
|
||||
QGEPath.h
|
||||
QGTracker.h
|
||||
QGILeaderLine.h
|
||||
@@ -72,7 +73,8 @@ set(TechDrawGui_UIC_SRCS
|
||||
TaskRichAnno.ui
|
||||
mrichtextedit.ui
|
||||
TaskBalloon.ui
|
||||
)
|
||||
TaskCosVertex.ui
|
||||
)
|
||||
|
||||
if(BUILD_QT5)
|
||||
qt5_wrap_ui(TechDrawGui_UIC_HDRS ${TechDrawGui_UIC_SRCS})
|
||||
@@ -102,6 +104,7 @@ SET(TechDrawGui_SRCS
|
||||
Command.cpp
|
||||
CommandCreateDims.cpp
|
||||
CommandDecorate.cpp
|
||||
CommandAnnotate.cpp
|
||||
Resources/TechDraw.qrc
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
@@ -137,6 +140,9 @@ SET(TechDrawGui_SRCS
|
||||
TaskRichAnno.ui
|
||||
TaskRichAnno.cpp
|
||||
TaskRichAnno.h
|
||||
TaskCosVertex.ui
|
||||
TaskCosVertex.cpp
|
||||
TaskCosVertex.h
|
||||
DrawGuiUtil.cpp
|
||||
DrawGuiUtil.h
|
||||
Rez.cpp
|
||||
@@ -285,6 +291,7 @@ SET(TechDrawGuiTaskDlgs_SRCS
|
||||
TaskGeomHatch.ui
|
||||
TaskLeaderLine.ui
|
||||
TaskRichAnno.ui
|
||||
TaskCosVertex.ui
|
||||
mrichtextedit.ui
|
||||
TaskBalloon.ui
|
||||
)
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#include <Mod/TechDraw/App/DrawViewDimension.h>
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
#include <Mod/TechDraw/App/DrawViewClip.h>
|
||||
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawViewDraft.h>
|
||||
#include <Mod/TechDraw/App/DrawViewMulti.h>
|
||||
@@ -641,46 +640,6 @@ bool CmdTechDrawProjGroup::isActive(void)
|
||||
// return DrawGuiUtil::needPage(this);
|
||||
//}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Annotation
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawAnnotation);
|
||||
|
||||
CmdTechDrawAnnotation::CmdTechDrawAnnotation()
|
||||
: Command("TechDraw_Annotation")
|
||||
{
|
||||
// setting the Gui eye-candy
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Insert Annotation");
|
||||
sToolTipText = QT_TR_NOOP("Insert Annotation");
|
||||
sWhatsThis = "TechDraw_NewAnnotation";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-annotation";
|
||||
}
|
||||
|
||||
void CmdTechDrawAnnotation::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
std::string FeatName = getUniqueObjectName("Annotation");
|
||||
openCommand("Create Annotation");
|
||||
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewAnnotation','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
||||
bool CmdTechDrawAnnotation::isActive(void)
|
||||
{
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_NewBalloon
|
||||
//===========================================================================
|
||||
@@ -1292,8 +1251,6 @@ bool CmdTechDrawExportPageDxf::isActive(void)
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTechDrawCommands(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
@@ -1305,7 +1262,7 @@ void CreateTechDrawCommands(void)
|
||||
rcCmdMgr.addCommand(new CmdTechDrawNewViewDetail());
|
||||
// rcCmdMgr.addCommand(new CmdTechDrawNewMulti()); //deprecated
|
||||
rcCmdMgr.addCommand(new CmdTechDrawProjGroup());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawAnnotation());
|
||||
// rcCmdMgr.addCommand(new CmdTechDrawAnnotation());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawClip());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawClipPlus());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawClipMinus());
|
||||
|
||||
406
src/Mod/TechDraw/Gui/CommandAnnotate.cpp
Normal file
@@ -0,0 +1,406 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 <QMessageBox>
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
# include <sstream>
|
||||
# include <cstdlib>
|
||||
# include <exception>
|
||||
#endif //#ifndef _PreComp_
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
# include <App/DocumentObject.h>
|
||||
# include <Gui/Action.h>
|
||||
# include <Gui/Application.h>
|
||||
# include <Gui/BitmapFactory.h>
|
||||
# include <Gui/Command.h>
|
||||
# include <Gui/Control.h>
|
||||
# include <Gui/Document.h>
|
||||
# include <Gui/Selection.h>
|
||||
# include <Gui/MainWindow.h>
|
||||
# include <Gui/FileDialog.h>
|
||||
# include <Gui/ViewProvider.h>
|
||||
|
||||
# include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/Gui/QGVPage.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "TaskLeaderLine.h"
|
||||
#include "TaskRichAnno.h"
|
||||
#include "TaskCosVertex.h"
|
||||
#include "ViewProviderPage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace std;
|
||||
|
||||
|
||||
//internal functions
|
||||
bool _checkSelectionHatch(Gui::Command* cmd);
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Leader
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawLeaderLine);
|
||||
|
||||
CmdTechDrawLeaderLine::CmdTechDrawLeaderLine()
|
||||
: Command("TechDraw_LeaderLine")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add a line to a view");
|
||||
sToolTipText = QT_TR_NOOP("Add a line to a view");
|
||||
sWhatsThis = "TechDraw_LeaderLine";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-mline";
|
||||
}
|
||||
|
||||
void CmdTechDrawLeaderLine::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
TechDraw::DrawView* baseFeat = nullptr;
|
||||
if (!selection.empty()) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
if( baseFeat == nullptr ) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
QObject::tr("Can not attach leader. No base View selected."));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
QObject::tr("You must select a base View for the line."));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TechDrawGui::TaskDlgLeaderLine(baseFeat,
|
||||
page));
|
||||
}
|
||||
|
||||
bool CmdTechDrawLeaderLine::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_RichAnno
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawRichAnno);
|
||||
|
||||
CmdTechDrawRichAnno::CmdTechDrawRichAnno()
|
||||
: Command("TechDraw_RichAnno")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add a rich text annotation");
|
||||
sToolTipText = QT_TR_NOOP("Add a rich text annotation");
|
||||
sWhatsThis = "TechDraw_RichAnno";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-textleader";
|
||||
}
|
||||
|
||||
void CmdTechDrawRichAnno::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
TechDraw::DrawView* baseFeat = nullptr;
|
||||
if (!selection.empty()) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
// if( baseFeat == nullptr ) {
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
// QObject::tr("Can not attach leader. No base View selected."));
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
// QObject::tr("You must select a base View for the line."));
|
||||
// return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgRichAnno(baseFeat,
|
||||
page));
|
||||
}
|
||||
|
||||
bool CmdTechDrawRichAnno::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_CosmeticVertex
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawCosmeticVertex);
|
||||
|
||||
CmdTechDrawCosmeticVertex::CmdTechDrawCosmeticVertex()
|
||||
: Command("TechDraw_CosmeticVertex")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add a cosmetic vertex");
|
||||
sToolTipText = QT_TR_NOOP("Add a cosmetic vertex");
|
||||
sWhatsThis = "TechDraw_CosmeticVertex";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-point";
|
||||
}
|
||||
|
||||
void CmdTechDrawCosmeticVertex::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> shapes = getSelection().
|
||||
getObjectsOfType(TechDraw::DrawViewPart::getClassTypeId());
|
||||
if (shapes.empty()) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("No DrawViewPart objects in this selection"));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawViewPart* baseFeat = nullptr;
|
||||
baseFeat = dynamic_cast<TechDraw::DrawViewPart*>((*shapes.begin()));
|
||||
if (baseFeat == nullptr) {
|
||||
Base::Console().Message("CMD::CosmeticVertex - 1st shape is not DVP. WTF?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgCosVertex(baseFeat,
|
||||
page));
|
||||
}
|
||||
|
||||
bool CmdTechDrawCosmeticVertex::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Midpoints
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawMidpoints);
|
||||
|
||||
CmdTechDrawMidpoints::CmdTechDrawMidpoints()
|
||||
: Command("TechDraw_Midpoints")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add midpoint vertices");
|
||||
sToolTipText = QT_TR_NOOP("Add midpoint vertices");
|
||||
sWhatsThis = "TechDraw_Midpoints";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-midpoint";
|
||||
}
|
||||
|
||||
void CmdTechDrawMidpoints::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
// TechDraw::DrawView* baseFeat = nullptr;
|
||||
// if (!selection.empty()) {
|
||||
// baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
// }
|
||||
|
||||
// Gui::Control().showDialog(new TaskDlgMidpoints(baseFeat,
|
||||
// page));
|
||||
Base::Console().Message("CMD::Midpoints - start dialog here!\n");
|
||||
}
|
||||
|
||||
bool CmdTechDrawMidpoints::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Quadrant
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawQuadrant);
|
||||
|
||||
CmdTechDrawQuadrant::CmdTechDrawQuadrant()
|
||||
: Command("TechDraw_Quadrant")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add quadrant vertices");
|
||||
sToolTipText = QT_TR_NOOP("Add quadrant vertices");
|
||||
sWhatsThis = "TechDraw_Quadrant";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-quadrant";
|
||||
}
|
||||
|
||||
void CmdTechDrawQuadrant::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
// TechDraw::DrawView* baseFeat = nullptr;
|
||||
// if (!selection.empty()) {
|
||||
// baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
// }
|
||||
|
||||
// Gui::Control().showDialog(new TaskDlgQuadrant(baseFeat,
|
||||
// page));
|
||||
Base::Console().Message("CMD::Quadrant - start dialog here!\n");
|
||||
}
|
||||
|
||||
bool CmdTechDrawQuadrant::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Annotation
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawAnnotation);
|
||||
|
||||
CmdTechDrawAnnotation::CmdTechDrawAnnotation()
|
||||
: Command("TechDraw_Annotation")
|
||||
{
|
||||
// setting the Gui eye-candy
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Insert Annotation");
|
||||
sToolTipText = QT_TR_NOOP("Insert Annotation");
|
||||
sWhatsThis = "TechDraw_NewAnnotation";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-annotation";
|
||||
}
|
||||
|
||||
void CmdTechDrawAnnotation::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
std::string FeatName = getUniqueObjectName("Annotation");
|
||||
openCommand("Create Annotation");
|
||||
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewAnnotation','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
||||
bool CmdTechDrawAnnotation::isActive(void)
|
||||
{
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
void CreateTechDrawCommandsAnnotate(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
rcCmdMgr.addCommand(new CmdTechDrawLeaderLine());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawRichAnno());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawCosmeticVertex());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawMidpoints());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawQuadrant());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawAnnotation());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Selection Validation Helpers
|
||||
//===========================================================================
|
||||
|
||||
|
||||
@@ -69,103 +69,44 @@ using namespace std;
|
||||
//internal functions
|
||||
bool _checkSelectionHatch(Gui::Command* cmd);
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_Leader
|
||||
//===========================================================================
|
||||
////===========================================================================
|
||||
//// TechDraw_Leader
|
||||
////===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawLeaderLine);
|
||||
//DEF_STD_CMD_A(CmdTechDrawLeaderLine);
|
||||
|
||||
CmdTechDrawLeaderLine::CmdTechDrawLeaderLine()
|
||||
: Command("TechDraw_LeaderLine")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add a line to a view");
|
||||
sToolTipText = QT_TR_NOOP("Add a line to a view");
|
||||
sWhatsThis = "TechDraw_LeaderLine";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-mline";
|
||||
}
|
||||
//CmdTechDrawLeaderLine::CmdTechDrawLeaderLine()
|
||||
// : Command("TechDraw_LeaderLine")
|
||||
//{
|
||||
// sAppModule = "TechDraw";
|
||||
// sGroup = QT_TR_NOOP("TechDraw");
|
||||
// sMenuText = QT_TR_NOOP("Add a line to a view");
|
||||
// sToolTipText = QT_TR_NOOP("Add a line to a view");
|
||||
// sWhatsThis = "TechDraw_LeaderLine";
|
||||
// sStatusTip = sToolTipText;
|
||||
// sPixmap = "actions/techdraw-mline";
|
||||
//}
|
||||
|
||||
void CmdTechDrawLeaderLine::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
//void CmdTechDrawLeaderLine::activated(int iMsg)
|
||||
//{
|
||||
// Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
// Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
// if (dlg != nullptr) {
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
// QObject::tr("Close active task dialog and try again."));
|
||||
// return;
|
||||
// }
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
// TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
// if (!page) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
TechDraw::DrawView* baseFeat = nullptr;
|
||||
if (!selection.empty()) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
if( baseFeat == nullptr ) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
QObject::tr("Can not attach leader. No base View selected."));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
QObject::tr("You must select a base View for the line."));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TechDrawGui::TaskDlgLeaderLine(baseFeat,
|
||||
page));
|
||||
}
|
||||
|
||||
bool CmdTechDrawLeaderLine::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_RichAnno
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawRichAnno);
|
||||
|
||||
CmdTechDrawRichAnno::CmdTechDrawRichAnno()
|
||||
: Command("TechDraw_RichAnno")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add a rich text annotation");
|
||||
sToolTipText = QT_TR_NOOP("Add a rich text annotation");
|
||||
sWhatsThis = "TechDraw_RichAnno";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-textleader";
|
||||
}
|
||||
|
||||
void CmdTechDrawRichAnno::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
TechDraw::DrawView* baseFeat = nullptr;
|
||||
if (!selection.empty()) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
// std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
// TechDraw::DrawView* baseFeat = nullptr;
|
||||
// if (!selection.empty()) {
|
||||
// baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
// if( baseFeat == nullptr ) {
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
// QObject::tr("Can not attach leader. No base View selected."));
|
||||
@@ -175,18 +116,77 @@ void CmdTechDrawRichAnno::activated(int iMsg)
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
// QObject::tr("You must select a base View for the line."));
|
||||
// return;
|
||||
}
|
||||
// }
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgRichAnno(baseFeat,
|
||||
page));
|
||||
}
|
||||
// Gui::Control().showDialog(new TechDrawGui::TaskDlgLeaderLine(baseFeat,
|
||||
// page));
|
||||
//}
|
||||
|
||||
bool CmdTechDrawRichAnno::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
//bool CmdTechDrawLeaderLine::isActive(void)
|
||||
//{
|
||||
// bool havePage = DrawGuiUtil::needPage(this);
|
||||
// bool haveView = DrawGuiUtil::needView(this, false);
|
||||
// return (havePage && haveView);
|
||||
//}
|
||||
|
||||
////===========================================================================
|
||||
//// TechDraw_RichAnno
|
||||
////===========================================================================
|
||||
|
||||
//DEF_STD_CMD_A(CmdTechDrawRichAnno);
|
||||
|
||||
//CmdTechDrawRichAnno::CmdTechDrawRichAnno()
|
||||
// : Command("TechDraw_RichAnno")
|
||||
//{
|
||||
// sAppModule = "TechDraw";
|
||||
// sGroup = QT_TR_NOOP("TechDraw");
|
||||
// sMenuText = QT_TR_NOOP("Add a rich text annotation");
|
||||
// sToolTipText = QT_TR_NOOP("Add a rich text annotation");
|
||||
// sWhatsThis = "TechDraw_RichAnno";
|
||||
// sStatusTip = sToolTipText;
|
||||
// sPixmap = "actions/techdraw-textleader";
|
||||
//}
|
||||
|
||||
//void CmdTechDrawRichAnno::activated(int iMsg)
|
||||
//{
|
||||
// Q_UNUSED(iMsg);
|
||||
// Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
// if (dlg != nullptr) {
|
||||
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
// QObject::tr("Close active task dialog and try again."));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
// if (!page) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
// TechDraw::DrawView* baseFeat = nullptr;
|
||||
// if (!selection.empty()) {
|
||||
// baseFeat = dynamic_cast<TechDraw::DrawView *>(selection[0].getObject());
|
||||
//// if( baseFeat == nullptr ) {
|
||||
//// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
//// QObject::tr("Can not attach leader. No base View selected."));
|
||||
//// return;
|
||||
//// }
|
||||
//// } else {
|
||||
//// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection Error"),
|
||||
//// QObject::tr("You must select a base View for the line."));
|
||||
//// return;
|
||||
// }
|
||||
|
||||
// Gui::Control().showDialog(new TaskDlgRichAnno(baseFeat,
|
||||
// page));
|
||||
//}
|
||||
|
||||
//bool CmdTechDrawRichAnno::isActive(void)
|
||||
//{
|
||||
// bool havePage = DrawGuiUtil::needPage(this);
|
||||
// bool haveView = DrawGuiUtil::needView(this, false);
|
||||
// return (havePage && haveView);
|
||||
//}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_NewHatch
|
||||
@@ -469,8 +469,8 @@ void CreateTechDrawCommandsDecorate(void)
|
||||
rcCmdMgr.addCommand(new CmdTechDrawImage());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawToggleFrame());
|
||||
// rcCmdMgr.addCommand(new CmdTechDrawRedrawPage());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawLeaderLine());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawRichAnno());
|
||||
// rcCmdMgr.addCommand(new CmdTechDrawLeaderLine());
|
||||
// rcCmdMgr.addCommand(new CmdTechDrawRichAnno());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawViewSection.h>
|
||||
@@ -57,6 +58,8 @@
|
||||
#include <Mod/TechDraw/App/DrawGeomHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawViewDetail.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/Cosmetic.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
@@ -77,6 +80,7 @@
|
||||
#include "ViewProviderViewPart.h"
|
||||
#include "MDIViewPage.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDrawGeometry;
|
||||
|
||||
@@ -458,6 +462,23 @@ void QGIViewPart::drawViewPart()
|
||||
// dumpPath(edgeId.str().c_str(),edgePath);
|
||||
}
|
||||
}
|
||||
// Draw Cosmetic Edges
|
||||
// int cosmoEdgeStart = 1000;
|
||||
// const std::vector<TechDrawGreometry::CosmeticEdge *> &cEdges = viewPart->getEdgeCosmetic();
|
||||
// std::vector<TechDrawGreometry::CosmeticEdge *>::const_iterator itcEdge = cEdges.begin();
|
||||
// QGIEdge* item;
|
||||
// for(int i = 0 ; itcEdge != cEdges.end(); itcEdge++, i++) {
|
||||
// item = new QGIEdge(cosmoEdgeStart + i);
|
||||
// addToGroup(item);
|
||||
// item->setPos(0.0,0.0);
|
||||
//// item->setPath(drawPainterPath(*itcEdge)); //this won't work
|
||||
// item->setWidth((*itcEdge)->width);
|
||||
// item->setColor((*itcEdge)->color.asValue<QColor>();
|
||||
// item->setZValue(ZVALUE::EDGE);
|
||||
// item->setPrettyNormal();
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// Draw Vertexs:
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
@@ -487,14 +508,42 @@ void QGIViewPart::drawViewPart()
|
||||
}
|
||||
} else if(!usePolygonHLR){ //Disable dots WHEN usePolygonHLR
|
||||
QGIVertex *item = new QGIVertex(i);
|
||||
item->setNormalColor(vertexColor);
|
||||
TechDraw::CosmeticVertex* cv = viewPart->getCosmeticVertexByLink(i);
|
||||
if (cv != nullptr) {
|
||||
Base::Console().Message("QGIVP::draw - found a cv!\n");
|
||||
cv->dump("QGIVP::draw");
|
||||
// item->setNormalColor(vertexColor);
|
||||
item->setNormalColor(cv->color.asValue<QColor>());
|
||||
item->setRadius(cv->size);
|
||||
// item->setRadius(lineWidth * vertexScaleFactor);
|
||||
// item->setStyle(cv->style);
|
||||
} else {
|
||||
item->setNormalColor(vertexColor);
|
||||
item->setRadius(lineWidth * vertexScaleFactor);
|
||||
}
|
||||
item->setPrettyNormal();
|
||||
addToGroup(item);
|
||||
item->setPos(Rez::guiX((*vert)->pnt.x), Rez::guiX((*vert)->pnt.y));
|
||||
item->setRadius(lineWidth * vertexScaleFactor);
|
||||
item->setZValue(ZVALUE::VERTEX);
|
||||
}
|
||||
}
|
||||
// //draw cosmetic vertices
|
||||
// int cosmoVertStart = 1000;
|
||||
// std::vector<CosmeticVertex*> cVerts = viewPart->getCosmeticVertex();
|
||||
// Base::Console().Message("QGIVP::draw - %s - cVerts: %d\n",getViewName(),cVerts.size());
|
||||
// std::vector<CosmeticVertex*>::const_iterator itcVert = cVerts.begin();
|
||||
// for(int i = 0 ; itcVert != cVerts.end(); ++itcVert, i++) {
|
||||
// QGIVertex *item = new QGIVertex(cosmoVertStart + i);
|
||||
// item->setNormalColor((*itcVert)->color.asValue<QColor>());
|
||||
// item->setPrettyNormal();
|
||||
// addToGroup(item);
|
||||
// //TODO: need to apply scale to position unless position is already scaled
|
||||
// item->setPos(Rez::guiX((*itcVert)->pageLocation.x), - Rez::guiX((*itcVert)->pageLocation.y));
|
||||
// item->setRadius((*itcVert)->size);
|
||||
// item->setStyle((Qt::PenStyle)(*itcVert)->style);
|
||||
// item->setZValue(ZVALUE::VERTEX);
|
||||
// Base::Console().Message("QGIVP::draw - cVert.toCSV: %s \n",(*itcVert)->toCSV().c_str());
|
||||
// }
|
||||
}
|
||||
|
||||
//draw detail highlights
|
||||
|
||||
@@ -35,6 +35,7 @@ class DrawViewSection;
|
||||
class DrawHatch;
|
||||
class DrawGeomHatch;
|
||||
class DrawViewDetail;
|
||||
class DrawView;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
|
||||
@@ -181,7 +181,7 @@ void QGTracker::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
|
||||
|
||||
void QGTracker::keyPressEvent(QKeyEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGT::keyPressEvent()\n");
|
||||
Base::Console().Message("QGT::keyPressEvent()\n");
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
terminateDrawing();
|
||||
}
|
||||
@@ -237,6 +237,7 @@ QPointF QGTracker::snapToAngle(QPointF dumbPt)
|
||||
//mouse event reactions
|
||||
void QGTracker::onMousePress(QPointF pos)
|
||||
{
|
||||
Base::Console().Message("QGT::onMousePress(%s)\n", TechDraw::DrawUtil::formatVector(pos).c_str());
|
||||
m_points.push_back(pos);
|
||||
TrackerMode mode = getTrackerMode();
|
||||
if (m_points.size() > 1) {
|
||||
@@ -254,18 +255,21 @@ void QGTracker::onMousePress(QPointF pos)
|
||||
break;
|
||||
case TrackerMode::Point:
|
||||
//do nothing
|
||||
// setPoint(m_points);
|
||||
break;
|
||||
}
|
||||
} else if (m_points.size() == 1) { //first point selected
|
||||
} else if (m_points.size() == 1) { //first point selected
|
||||
Base::Console().Message("QGT::onMousePress - m_points.size == 1\n");
|
||||
getPickedQGIV(pos);
|
||||
setCursor(Qt::CrossCursor);
|
||||
Q_EMIT qViewPicked(pos, m_qgParent);
|
||||
// Q_EMIT qViewPicked(pos, m_qgParent); //not in use yet.
|
||||
if (mode == TrackerMode::Point) {
|
||||
Base::Console().Message("QGT::onMousePress - mode = Point\n");
|
||||
setPoint(m_points);
|
||||
terminateDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( (m_points.size() == 2) &&
|
||||
( (getTrackerMode() == TrackerMode::Circle) ||
|
||||
(getTrackerMode() == TrackerMode::Rectangle) ) ) { //only 2 points for square/circle
|
||||
@@ -297,8 +301,12 @@ void QGTracker::onMouseMove(QPointF pos)
|
||||
|
||||
void QGTracker::onDoubleClick(QPointF pos)
|
||||
{
|
||||
// Base::Console().Message("QGTracker::onDoubleClick()\n");
|
||||
Base::Console().Message("QGTracker::onDoubleClick()\n");
|
||||
Q_UNUSED(pos);
|
||||
TrackerMode mode = getTrackerMode();
|
||||
if (mode == TrackerMode::Point) {
|
||||
setPoint(m_points);
|
||||
}
|
||||
terminateDrawing();
|
||||
}
|
||||
|
||||
@@ -448,7 +456,7 @@ void QGTracker::setPoint(std::vector<QPointF> pts)
|
||||
prepareGeometryChange();
|
||||
QPainterPath newPath;
|
||||
QPointF center = pts.front();
|
||||
double radius = 5.0;
|
||||
double radius = 50.0;
|
||||
newPath.addEllipse(center, radius, radius);
|
||||
setPath(newPath);
|
||||
setPrettyNormal();
|
||||
@@ -466,7 +474,7 @@ std::vector<Base::Vector3d> QGTracker::convertPoints(void)
|
||||
|
||||
void QGTracker::terminateDrawing(void)
|
||||
{
|
||||
// Base::Console().Message("QGTracker::terminateDrawing()\n");
|
||||
Base::Console().Message("QGTracker::terminateDrawing()\n");
|
||||
m_track->hide();
|
||||
setCursor(Qt::ArrowCursor);
|
||||
Q_EMIT drawingFinished(m_points, m_qgParent);
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
<file>icons/actions/techdraw-mline.svg</file>
|
||||
<file>icons/actions/techdraw-textleader.svg</file>
|
||||
<file>icons/actions/techdraw-point.svg</file>
|
||||
<file>icons/actions/techdraw-midpoint.svg</file>
|
||||
<file>icons/actions/techdraw-quadrant.svg</file>
|
||||
<file>icons/actions/section-up.svg</file>
|
||||
<file>icons/actions/section-down.svg</file>
|
||||
<file>icons/actions/section-left.svg</file>
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -15,7 +15,7 @@
|
||||
height="64"
|
||||
id="svg3085"
|
||||
sodipodi:docname="techdraw-mline.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
inkscape:version="0.92.4 (unknown)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
@@ -31,7 +31,7 @@
|
||||
showgrid="true"
|
||||
inkscape:zoom="8.03125"
|
||||
inkscape:cx="32"
|
||||
inkscape:cy="32"
|
||||
inkscape:cy="5.2857789"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="26"
|
||||
inkscape:window-maximized="1"
|
||||
@@ -166,7 +166,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
@@ -179,80 +179,83 @@
|
||||
x="13.788582"
|
||||
y="46.145554"
|
||||
id="tspan3132" /></text>
|
||||
<path
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 39.867728,50.432299 -5.043926,3.249433 -14.37481,-26.019768 5.043926,-3.249432 z"
|
||||
id="path3061-2-6"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 37.798712,50.675315 24.245786,26.416728"
|
||||
id="path3063-7-1"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 14.384846,55.128496 8.5892901,53.575582 18.204445,25.447086 24,27 Z"
|
||||
id="path3061-2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 10.858731,52.833317 8.939981,-25.6087"
|
||||
id="path3063-7"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 40.599427,54.421192 34.803871,52.868278 50.204445,7.8977836 56,9.450698 Z"
|
||||
id="path3061"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 37.073312,52.126013 51.798712,9.675315"
|
||||
id="path3063"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-71"
|
||||
d="M 44.970374,5.822785 A 8.993818,8.9934077 0.02042283 1 1 58.632785,17.5224 8.993818,8.9934077 0.02042283 1 1 44.970374,5.822785 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient5088);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-7-3"
|
||||
d="M 46.49299,7.133747 A 6.9999997,7.0000001 0 1 1 57.126578,16.240159 6.9999997,7.0000001 0 0 1 46.49299,7.133747 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-71-6"
|
||||
d="M 30.970374,45.82823 A 8.993818,8.9934077 0.02042283 1 1 44.632785,57.527845 8.993818,8.9934077 0.02042283 1 1 30.970374,45.82823 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient5064);fill-opacity:1;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-7-3-2"
|
||||
d="M 32.49299,47.139192 A 6.9999997,7.0000001 0 1 1 43.126578,56.245604 6.9999997,7.0000001 0 0 1 32.49299,47.139192 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-71-8"
|
||||
d="M 14.970374,19.82823 A 8.993818,8.9934077 0.02042283 1 1 28.632785,31.527845 8.993818,8.9934077 0.02042283 1 1 14.970374,19.82823 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient5080);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-7-3-8"
|
||||
d="M 16.49299,21.139192 A 6.9999997,7.0000001 0 1 1 27.126578,30.245604 6.9999997,7.0000001 0 0 1 16.49299,21.139192 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-71-1"
|
||||
d="M 4.964639,45.82823 A 8.993818,8.9934077 0.02042283 1 1 18.62705,57.527845 8.993818,8.9934077 0.02042283 1 1 4.964639,45.82823 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient5072);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path4250-7-3-5"
|
||||
d="M 6.487255,47.139192 A 6.9999997,7.0000001 0 1 1 17.120843,56.245604 6.9999997,7.0000001 0 0 1 6.487255,47.139192 Z" />
|
||||
<g
|
||||
id="g1815">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3061-2-6"
|
||||
d="m 39.867728,50.432299 -5.043926,3.249433 -14.37481,-26.019768 5.043926,-3.249432 z"
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3063-7-1"
|
||||
d="M 37.798712,50.675315 24.245786,26.416728"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3061-2"
|
||||
d="M 14.384846,55.128496 8.5892901,53.575582 18.204445,25.447086 24,27 Z"
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3063-7"
|
||||
d="m 10.858731,52.833317 8.939981,-25.6087"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3061"
|
||||
d="M 40.599427,54.421192 34.803871,52.868278 50.204445,7.8977836 56,9.450698 Z"
|
||||
style="fill:#d3d7cf;stroke:#2e3436;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3063"
|
||||
d="M 37.073312,52.126013 51.798712,9.675315"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
d="M 44.970374,5.822785 A 8.993818,8.9934077 0.02042283 1 1 58.632785,17.5224 8.993818,8.9934077 0.02042283 1 1 44.970374,5.822785 Z"
|
||||
id="path4250-71"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 46.49299,7.133747 A 6.9999997,7.0000001 0 1 1 57.126578,16.240159 6.9999997,7.0000001 0 0 1 46.49299,7.133747 Z"
|
||||
id="path4250-7-3"
|
||||
style="fill:url(#linearGradient5088);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 30.970374,45.82823 A 8.993818,8.9934077 0.02042283 1 1 44.632785,57.527845 8.993818,8.9934077 0.02042283 1 1 30.970374,45.82823 Z"
|
||||
id="path4250-71-6"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 32.49299,47.139192 A 6.9999997,7.0000001 0 1 1 43.126578,56.245604 6.9999997,7.0000001 0 0 1 32.49299,47.139192 Z"
|
||||
id="path4250-7-3-2"
|
||||
style="fill:url(#linearGradient5064);fill-opacity:1;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 14.970374,19.82823 A 8.993818,8.9934077 0.02042283 1 1 28.632785,31.527845 8.993818,8.9934077 0.02042283 1 1 14.970374,19.82823 Z"
|
||||
id="path4250-71-8"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 16.49299,21.139192 A 6.9999997,7.0000001 0 1 1 27.126578,30.245604 6.9999997,7.0000001 0 0 1 16.49299,21.139192 Z"
|
||||
id="path4250-7-3-8"
|
||||
style="fill:url(#linearGradient5080);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 4.964639,45.82823 A 8.993818,8.9934077 0.02042283 1 1 18.62705,57.527845 8.993818,8.9934077 0.02042283 1 1 4.964639,45.82823 Z"
|
||||
id="path4250-71-1"
|
||||
style="fill:none;stroke:#2e2900;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="M 6.487255,47.139192 A 6.9999997,7.0000001 0 1 1 17.120843,56.245604 6.9999997,7.0000001 0 0 1 6.487255,47.139192 Z"
|
||||
id="path4250-7-3-5"
|
||||
style="fill:url(#linearGradient5072);fill-opacity:1.0;stroke:#729fcf;stroke-width:1.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.9 KiB |
@@ -30,8 +30,8 @@
|
||||
id="namedview983"
|
||||
showgrid="true"
|
||||
inkscape:zoom="8.03125"
|
||||
inkscape:cx="39.769112"
|
||||
inkscape:cy="41.31852"
|
||||
inkscape:cx="17.107633"
|
||||
inkscape:cy="40.322411"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="26"
|
||||
inkscape:window-maximized="1"
|
||||
@@ -139,7 +139,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
@@ -154,7 +154,7 @@
|
||||
id="tspan3132" /></text>
|
||||
<g
|
||||
id="g963"
|
||||
transform="translate(-5.8015795,-19.678038)">
|
||||
transform="matrix(2,0,0,2,-43.603159,-71.356076)">
|
||||
<path
|
||||
d="M 30.970374,45.82823 A 8.993818,8.9934077 0.02042283 1 1 44.632785,57.527845 8.993818,8.9934077 0.02042283 1 1 30.970374,45.82823 Z"
|
||||
id="path4250-71-6"
|
||||
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -85,6 +85,11 @@ Base::Vector3d Rez::appX(Base::Vector3d v)
|
||||
return result;
|
||||
}
|
||||
|
||||
QPointF Rez::appX(QPointF p)
|
||||
{
|
||||
return appPt(p);
|
||||
}
|
||||
|
||||
|
||||
//Misc conversions
|
||||
QPointF Rez::guiPt(QPointF p)
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
static double appX(double x);
|
||||
static Base::Vector2d appX(Base::Vector2d v);
|
||||
static Base::Vector3d appX(Base::Vector3d v);
|
||||
static QPointF appX(QPointF p);
|
||||
|
||||
static QPointF guiPt(QPointF p);
|
||||
static QPointF appPt(QPointF p);
|
||||
|
||||
391
src/Mod/TechDraw/Gui/TaskCosVertex.cpp
Normal file
@@ -0,0 +1,391 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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>
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <QStatusBar>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/Cosmetic.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskCosVertex.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "QGTracker.h"
|
||||
#include "QGEPath.h"
|
||||
#include "Rez.h"
|
||||
|
||||
#include "TaskCosVertex.h"
|
||||
|
||||
using namespace Gui;
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
//ctor for creation
|
||||
TaskCosVertex::TaskCosVertex(TechDraw::DrawViewPart* baseFeat,
|
||||
TechDraw::DrawPage* page) :
|
||||
ui(new Ui_TaskCosVertex),
|
||||
m_tracker(nullptr),
|
||||
m_baseFeat(baseFeat),
|
||||
m_basePage(page),
|
||||
m_createMode(true),
|
||||
m_inProgressLock(false),
|
||||
m_pbTrackerState(TRACKERPICK),
|
||||
m_savePoint(QPointF(0.0,0.0)),
|
||||
pointFromTracker(false)
|
||||
{
|
||||
if ( (m_basePage == nullptr) ||
|
||||
(m_baseFeat == nullptr) ) {
|
||||
//should be caught in CMD caller
|
||||
Base::Console().Error("TaskCosVertex - bad parameters. Can not proceed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_basePage->getDocument());
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(m_basePage);
|
||||
ViewProviderPage* vpp = static_cast<ViewProviderPage*>(vp);
|
||||
m_mdi = vpp->getMDIViewPage();
|
||||
m_scene = m_mdi->m_scene;
|
||||
m_view = m_mdi->getQGVPage();
|
||||
|
||||
setUiPrimary();
|
||||
|
||||
connect(ui->pbTracker, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onTrackerClicked(bool)));
|
||||
|
||||
m_trackerMode = QGTracker::TrackerMode::Point;
|
||||
}
|
||||
|
||||
TaskCosVertex::~TaskCosVertex()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TaskCosVertex::updateTask()
|
||||
{
|
||||
// blockUpdate = true;
|
||||
|
||||
// blockUpdate = false;
|
||||
}
|
||||
|
||||
void TaskCosVertex::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskCosVertex::setUiPrimary()
|
||||
{
|
||||
// Base::Console().Message("TCV::setUiPrimary()\n");
|
||||
setWindowTitle(QObject::tr("New Cosmetic Vertex"));
|
||||
|
||||
if (m_baseFeat != nullptr) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
}
|
||||
ui->pbTracker->setText(QString::fromUtf8("Point Picker"));
|
||||
ui->pbTracker->setEnabled(true);
|
||||
ui->qsbX->setEnabled(true);
|
||||
ui->qsbY->setEnabled(true);
|
||||
ui->qsbZ->setEnabled(false);
|
||||
}
|
||||
|
||||
void TaskCosVertex::updateUi(void)
|
||||
{
|
||||
//need to unscale & unRez m_savePoint for display
|
||||
// double scale = m_baseFeat->getScale();
|
||||
// double x = Rez::appX(m_savePoint.x() / scale);
|
||||
// double y = Rez::appX(- m_savePoint.y() / scale) ;
|
||||
double x = m_savePoint.x();
|
||||
double y = - m_savePoint.y();
|
||||
double z = 0.0;
|
||||
ui->qsbX->setValue(x);
|
||||
ui->qsbY->setValue(y);
|
||||
ui->qsbZ->setValue(z);
|
||||
}
|
||||
|
||||
void TaskCosVertex::addCosVertex(QPointF qPos)
|
||||
{
|
||||
// Base::Console().Message("TCV::addCosVertex(%s)\n", TechDraw::DrawUtil::formatVector(qPos).c_str());
|
||||
Base::Vector3d pos(qPos.x(), -qPos.y());
|
||||
// int idx =
|
||||
(void) m_baseFeat->addRandomVertex(pos);
|
||||
m_baseFeat->requestPaint();
|
||||
}
|
||||
|
||||
|
||||
//********** Tracker routines *******************************************************************
|
||||
void TaskCosVertex::onTrackerClicked(bool b)
|
||||
{
|
||||
Q_UNUSED(b);
|
||||
Base::Console().Message("TCV::onTrackerClicked() m_pbTrackerState: %d\n",
|
||||
m_pbTrackerState);
|
||||
if (m_pbTrackerState == TRACKERCANCEL) {
|
||||
removeTracker();
|
||||
|
||||
m_pbTrackerState = TRACKERPICK;
|
||||
ui->pbTracker->setText(QString::fromUtf8("Pick Points"));
|
||||
enableTaskButtons(true);
|
||||
|
||||
setEditCursor(Qt::ArrowCursor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (getCreateMode()) {
|
||||
m_inProgressLock = true;
|
||||
m_saveContextPolicy = m_mdi->contextMenuPolicy();
|
||||
m_mdi->setContextMenuPolicy(Qt::PreventContextMenu);
|
||||
m_trackerMode = QGTracker::TrackerMode::Point;
|
||||
setEditCursor(Qt::CrossCursor);
|
||||
startTracker();
|
||||
|
||||
QString msg = tr("Pick a point for cosmetic vertex");
|
||||
getMainWindow()->statusBar()->show();
|
||||
Gui::getMainWindow()->showMessage(msg,3000);
|
||||
ui->pbTracker->setText(QString::fromUtf8("Escape picking"));
|
||||
ui->pbTracker->setEnabled(true);
|
||||
m_pbTrackerState = TRACKERCANCEL;
|
||||
enableTaskButtons(false);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskCosVertex::startTracker(void)
|
||||
{
|
||||
// Base::Console().Message("TCV::startTracker()\n");
|
||||
if (m_trackerMode == QGTracker::TrackerMode::None) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_tracker == nullptr) {
|
||||
m_tracker = new QGTracker(m_scene, m_trackerMode);
|
||||
QObject::connect(
|
||||
m_tracker, SIGNAL(drawingFinished(std::vector<QPointF>, QGIView*)),
|
||||
this , SLOT (onTrackerFinished(std::vector<QPointF>, QGIView*))
|
||||
);
|
||||
} else {
|
||||
//this is too harsh. but need to avoid restarting process
|
||||
throw Base::RuntimeError("TechDrawNewLeader - tracker already active\n");
|
||||
}
|
||||
setEditCursor(Qt::CrossCursor);
|
||||
QString msg = tr("Left click to set a point");
|
||||
Gui::getMainWindow()->statusBar()->show();
|
||||
Gui::getMainWindow()->showMessage(msg,3000);
|
||||
}
|
||||
|
||||
void TaskCosVertex::onTrackerFinished(std::vector<QPointF> pts, QGIView* qgParent)
|
||||
{
|
||||
Base::Console().Message("TCV::onTrackerFinished()\n");
|
||||
if (pts.empty()) {
|
||||
Base::Console().Error("TaskCosVertex - no points available\n");
|
||||
return;
|
||||
}
|
||||
if (qgParent != nullptr) {
|
||||
m_qgParent = qgParent;
|
||||
} else {
|
||||
//if vertex is outside of baseFeat, qgParent will be nullptr
|
||||
QGVPage* qgvp = m_mdi->getQGVPage();
|
||||
QGIView* qgiv = qgvp->findQViewForDocObj(m_baseFeat);
|
||||
m_qgParent = qgiv;
|
||||
Base::Console().Message("TaskCosVertex - qgParent is nullptr\n");
|
||||
// return;
|
||||
}
|
||||
|
||||
//save point unscaled.
|
||||
double scale = m_baseFeat->getScale();
|
||||
QPointF temp = pts.front();
|
||||
QPointF temp2 = m_qgParent->mapFromScene(temp) / scale;
|
||||
m_savePoint = Rez::appX(temp2);
|
||||
pointFromTracker = true;
|
||||
updateUi();
|
||||
m_tracker->sleep(true);
|
||||
m_inProgressLock = false;
|
||||
ui->pbTracker->setEnabled(false);
|
||||
enableTaskButtons(true);
|
||||
setEditCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void TaskCosVertex::removeTracker(void)
|
||||
{
|
||||
// Base::Console().Message("TCV::removeTracker()\n");
|
||||
if ( (m_tracker != nullptr) &&
|
||||
(m_tracker->scene() != nullptr) ) {
|
||||
m_scene->removeItem(m_tracker);
|
||||
delete m_tracker;
|
||||
m_tracker = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void TaskCosVertex::setEditCursor(QCursor c)
|
||||
{
|
||||
if (m_baseFeat != nullptr) {
|
||||
QGIView* qgivBase = m_view->findQViewForDocObj(m_baseFeat);
|
||||
qgivBase->setCursor(c);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskCosVertex::abandonEditSession(void)
|
||||
{
|
||||
QString msg = tr("In progress edit abandoned. Start over.");
|
||||
getMainWindow()->statusBar()->show();
|
||||
Gui::getMainWindow()->showMessage(msg,4000);
|
||||
|
||||
ui->pbTracker->setEnabled(true);
|
||||
|
||||
setEditCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void TaskCosVertex::saveButtons(QPushButton* btnOK,
|
||||
QPushButton* btnCancel)
|
||||
{
|
||||
m_btnOK = btnOK;
|
||||
m_btnCancel = btnCancel;
|
||||
}
|
||||
|
||||
void TaskCosVertex::enableTaskButtons(bool b)
|
||||
{
|
||||
m_btnOK->setEnabled(b);
|
||||
m_btnCancel->setEnabled(b);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
bool TaskCosVertex::accept()
|
||||
{
|
||||
// Base::Console().Message("TCV::accept()\n");
|
||||
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument());
|
||||
if (!doc) return false;
|
||||
|
||||
removeTracker();
|
||||
if (pointFromTracker) {
|
||||
addCosVertex(m_savePoint);
|
||||
} else {
|
||||
double x = ui->qsbX->rawValue();
|
||||
double y = ui->qsbY->rawValue();
|
||||
// double z = ui->qsbZ->rawValue();
|
||||
QPointF uiPoint(x,-y);
|
||||
addCosVertex(uiPoint);
|
||||
}
|
||||
m_baseFeat->recomputeFeature();
|
||||
m_baseFeat->requestPaint();
|
||||
m_mdi->setContextMenuPolicy(m_saveContextPolicy);
|
||||
m_trackerMode = QGTracker::TrackerMode::None;
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskCosVertex::reject()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument());
|
||||
if (!doc) return false;
|
||||
|
||||
if (m_mdi != nullptr) {
|
||||
m_mdi->setContextMenuPolicy(m_saveContextPolicy);
|
||||
}
|
||||
m_trackerMode = QGTracker::TrackerMode::None;
|
||||
|
||||
//make sure any dangling objects are cleaned up
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
TaskDlgCosVertex::TaskDlgCosVertex(TechDraw::DrawViewPart* baseFeat,
|
||||
TechDraw::DrawPage* page)
|
||||
: TaskDialog()
|
||||
{
|
||||
widget = new TaskCosVertex(baseFeat,page);
|
||||
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-mline"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskDlgCosVertex::~TaskDlgCosVertex()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgCosVertex::update()
|
||||
{
|
||||
// widget->updateTask();
|
||||
}
|
||||
|
||||
void TaskDlgCosVertex::modifyStandardButtons(QDialogButtonBox* box)
|
||||
{
|
||||
QPushButton* btnOK = box->button(QDialogButtonBox::Ok);
|
||||
QPushButton* btnCancel = box->button(QDialogButtonBox::Cancel);
|
||||
widget->saveButtons(btnOK, btnCancel);
|
||||
}
|
||||
|
||||
//==== calls from the TaskView ===============================================================
|
||||
void TaskDlgCosVertex::open()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgCosVertex::clicked(int)
|
||||
{
|
||||
}
|
||||
|
||||
bool TaskDlgCosVertex::accept()
|
||||
{
|
||||
widget->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskDlgCosVertex::reject()
|
||||
{
|
||||
widget->reject();
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_TaskCosVertex.cpp>
|
||||
175
src/Mod/TechDraw/Gui/TaskCosVertex.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 TECHDRAWGUI_TASKCOSVERTEX_H
|
||||
#define TECHDRAWGUI_TASKCOSVERTEX_H
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskCosVertex.h>
|
||||
|
||||
#include "QGTracker.h"
|
||||
|
||||
//TODO: make this a proper enum
|
||||
#define TRACKERPICK 0
|
||||
#define TRACKEREDIT 1
|
||||
#define TRACKERCANCEL 2
|
||||
#define TRACKERCANCELEDIT 3
|
||||
|
||||
class Ui_TaskCosVertex;
|
||||
|
||||
namespace App {
|
||||
class DocumentObject;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawPage;
|
||||
class DrawView;
|
||||
class DrawCosVertex;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
class QGVPage;
|
||||
class QGIView;
|
||||
class QGIPrimPath;
|
||||
class MDIViewPage;
|
||||
class QGTracker;
|
||||
class QGEPath;
|
||||
class QGMText;
|
||||
class QGICosVertex;
|
||||
class ViewProviderLeader;
|
||||
|
||||
class TaskCosVertex : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskCosVertex(TechDraw::DrawViewPart* baseFeat,
|
||||
TechDraw::DrawPage* page);
|
||||
/* TaskCosVertex(TechDrawGui::ViewProviderLeader* leadVP);*/
|
||||
~TaskCosVertex();
|
||||
|
||||
public Q_SLOTS:
|
||||
void onTrackerClicked(bool b);
|
||||
void onTrackerFinished(std::vector<QPointF> pts, QGIView* qgParent);
|
||||
|
||||
public:
|
||||
virtual bool accept();
|
||||
virtual bool reject();
|
||||
virtual void setCreateMode(bool b) { m_createMode = b; }
|
||||
virtual bool getCreateMode(void) { return m_createMode; }
|
||||
void updateTask();
|
||||
void saveButtons(QPushButton* btnOK,
|
||||
QPushButton* btnCancel);
|
||||
void enableTaskButtons(bool b);
|
||||
|
||||
/*protected Q_SLOTS:*/
|
||||
/* void onPointPicked(QPointF pt);*/
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void startTracker(void);
|
||||
void removeTracker(void);
|
||||
void abandonEditSession(void);
|
||||
|
||||
void addCosVertex(QPointF qPos);
|
||||
|
||||
void blockButtons(bool b);
|
||||
void setUiPrimary(void);
|
||||
void updateUi(void);
|
||||
void setEditCursor(QCursor c);
|
||||
|
||||
QGIView* findParentQGIV();
|
||||
|
||||
private:
|
||||
Ui_TaskCosVertex * ui;
|
||||
bool blockUpdate;
|
||||
|
||||
QGTracker* m_tracker;
|
||||
|
||||
MDIViewPage* m_mdi;
|
||||
QGraphicsScene* m_scene;
|
||||
QGVPage* m_view;
|
||||
/* ViewProviderLeader* m_lineVP;*/
|
||||
TechDraw::DrawViewPart* m_baseFeat;
|
||||
TechDraw::DrawPage* m_basePage;
|
||||
/* TechDraw::DrawCosVertex* m_lineFeat;*/
|
||||
/* std::string m_leaderName;*/
|
||||
/* std::string m_leaderType;*/
|
||||
QGIView* m_qgParent;
|
||||
std::string m_qgParentName;
|
||||
|
||||
bool m_createMode;
|
||||
|
||||
QGTracker::TrackerMode m_trackerMode;
|
||||
Qt::ContextMenuPolicy m_saveContextPolicy;
|
||||
bool m_inProgressLock;
|
||||
|
||||
QPushButton* m_btnOK;
|
||||
QPushButton* m_btnCancel;
|
||||
|
||||
int m_pbTrackerState;
|
||||
QPointF m_savePoint;
|
||||
bool pointFromTracker;
|
||||
};
|
||||
|
||||
class TaskDlgCosVertex : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgCosVertex(TechDraw::DrawViewPart* baseFeat,
|
||||
TechDraw::DrawPage* page);
|
||||
~TaskDlgCosVertex();
|
||||
|
||||
public:
|
||||
/// is called the TaskView when the dialog is opened
|
||||
virtual void open();
|
||||
/// is called by the framework if an button is clicked which has no accept or reject role
|
||||
virtual void clicked(int);
|
||||
/// is called by the framework if the dialog is accepted (Ok)
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual void helpRequested() { return;}
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
void update();
|
||||
|
||||
void modifyStandardButtons(QDialogButtonBox* box);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
TaskCosVertex * widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
} //namespace TechDrawGui
|
||||
|
||||
#endif // #ifndef TECHDRAWGUI_TASKCOSVERTEX_H
|
||||
211
src/Mod/TechDraw/Gui/TaskCosVertex.ui
Normal file
@@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TechDrawGui::TaskCosVertex</class>
|
||||
<widget class="QWidget" name="TechDrawGui::TaskCosVertex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>409</width>
|
||||
<height>405</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Cosmetic Vertex</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="Resources/TechDraw.qrc">
|
||||
<normaloff>:/icons/actions/techdraw-point.svg</normaloff>:/icons/actions/techdraw-point.svg</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leBaseView">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Base View</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbTracker">
|
||||
<property name="text">
|
||||
<string>Point Picker</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="3,0,3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbX">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbY">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbZ">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/QuantitySpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="Resources/TechDraw.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -21,7 +21,6 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
@@ -61,7 +60,6 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
*draw << "TechDraw_NewViewSection";
|
||||
*draw << "TechDraw_NewViewDetail";
|
||||
*draw << "Separator";
|
||||
*draw << "TechDraw_Annotation";
|
||||
*draw << "TechDraw_DraftView";
|
||||
*draw << "TechDraw_ArchView";
|
||||
*draw << "TechDraw_Spreadsheet";
|
||||
@@ -89,8 +87,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
*draw << "TechDraw_Image";
|
||||
*draw << "TechDraw_ToggleFrame";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
*draw << "TechDraw_Annotation";
|
||||
*draw << "TechDraw_LeaderLine";
|
||||
*draw << "TechDraw_RichAnno";
|
||||
*draw << "TechDraw_CosmeticVertex";
|
||||
*draw << "TechDraw_Midpoints";
|
||||
*draw << "TechDraw_Quadrant";
|
||||
|
||||
return root;
|
||||
}
|
||||
@@ -110,7 +112,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
*views << "TechDraw_ProjGroup";
|
||||
*views << "TechDraw_NewViewSection";
|
||||
*views << "TechDraw_NewViewDetail";
|
||||
*views << "TechDraw_Annotation";
|
||||
// *views << "TechDraw_Annotation";
|
||||
*views << "TechDraw_DraftView";
|
||||
*views << "TechDraw_ArchView";
|
||||
*views << "TechDraw_Spreadsheet";
|
||||
@@ -147,8 +149,16 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
*decor << "TechDraw_LeaderLine";
|
||||
*decor << "TechDraw_RichAnno";
|
||||
|
||||
Gui::ToolBarItem *anno = new Gui::ToolBarItem(root);
|
||||
anno->setCommand("TechDraw Annotation");
|
||||
*anno << "TechDraw_Annotation";
|
||||
*anno << "TechDraw_LeaderLine";
|
||||
*anno << "TechDraw_RichAnno";
|
||||
*anno << "TechDraw_CosmeticVertex";
|
||||
*anno << "TechDraw_Midpoints";
|
||||
*anno << "TechDraw_Quadrant";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -167,7 +177,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
*views << "TechDraw_ProjGroup";
|
||||
*views << "TechDraw_NewViewSection";
|
||||
*views << "TechDraw_NewViewDetail";
|
||||
*views << "TechDraw_Annotation";
|
||||
// *views << "TechDraw_Annotation";
|
||||
*views << "TechDraw_DraftView";
|
||||
*views << "TechDraw_Spreadsheet";
|
||||
|
||||
@@ -203,8 +213,17 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
*decor << "TechDraw_LeaderLine";
|
||||
*decor << "TechDraw_RichAnno";
|
||||
// *decor << "TechDraw_LeaderLine";
|
||||
// *decor << "TechDraw_RichAnno";
|
||||
|
||||
Gui::ToolBarItem *anno = new Gui::ToolBarItem(root);
|
||||
anno->setCommand("TechDraw Annotation");
|
||||
*anno << "TechDraw_Annotation";
|
||||
*anno << "TechDraw_LeaderLine";
|
||||
*anno << "TechDraw_RichAnno";
|
||||
*anno << "TechDraw_CosmeticVertex";
|
||||
*anno << "TechDraw_Midpoints";
|
||||
*anno << "TechDraw_Quadrant";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||