Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add centermarks for circles in Views
- Loading branch information
1 parent
464a8f3
commit af7d257
Showing
9 changed files
with
239 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2016 Wandererfan <WandererFan@gmail.com> * | ||
* * | ||
* This file is part of the FreeCAD CAx development system. * | ||
* * | ||
* This library is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Library General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; see the file COPYING.LIB. If not, * | ||
* write to the Free Software Foundation, Inc., 59 Temple Place, * | ||
* Suite 330, Boston, MA 02111-1307, USA * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "PreCompiled.h" | ||
#ifndef _PreComp_ | ||
#include <assert.h> | ||
#include <QGraphicsScene> | ||
#include <QGraphicsSceneHoverEvent> | ||
#include <QMouseEvent> | ||
#include <QPainter> | ||
#include <QStyleOptionGraphicsItem> | ||
#endif | ||
|
||
#include <App/Application.h> | ||
#include <App/Material.h> | ||
#include <Base/Console.h> | ||
#include <Base/Parameter.h> | ||
|
||
#include "QGICMark.h" | ||
|
||
using namespace TechDrawGui; | ||
|
||
QGICMark::QGICMark(int index) : QGIVertex(index) | ||
{ | ||
m_size = 3.0; | ||
m_thick = 0.75; | ||
draw(); | ||
} | ||
void QGICMark::draw(void) | ||
{ | ||
QPainterPath cmPath; | ||
cmPath.moveTo(0.0,m_size); | ||
cmPath.lineTo(0.0,-m_size); | ||
cmPath.moveTo(m_size,0.0); | ||
cmPath.lineTo(-m_size,0.0); | ||
setPath(cmPath); | ||
} | ||
|
||
void QGICMark::setSize(float s) | ||
{ | ||
m_size = s; | ||
draw(); | ||
} | ||
|
||
void QGICMark::setThick(float t) | ||
{ | ||
m_thick = t; | ||
m_pen.setWidthF(m_thick); | ||
draw(); | ||
} | ||
|
||
QColor QGICMark::getCMarkColor() | ||
{ | ||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() | ||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); | ||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CMarkColor", 0x08080800)); | ||
return fcColor.asValue<QColor>(); | ||
} | ||
|
||
void QGICMark::setPrettyNormal() { | ||
m_colCurrent = getCMarkColor(); | ||
update(); | ||
} | ||
|
||
void QGICMark::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | ||
{ | ||
QStyleOptionGraphicsItem myOption(*option); | ||
myOption.state &= ~QStyle::State_Selected; | ||
|
||
m_pen.setWidthF(m_thick); | ||
|
||
QGIVertex::paint (painter, &myOption, widget); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2013 Luke Parry <l.parry@warwick.ac.uk> * | ||
* * | ||
* This file is part of the FreeCAD CAx development system. * | ||
* * | ||
* This library is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Library General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; see the file COPYING.LIB. If not, * | ||
* write to the Free Software Foundation, Inc., 59 Temple Place, * | ||
* Suite 330, Boston, MA 02111-1307, USA * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef DRAWINGGUI_QGRAPHICSITEMCMARK_H | ||
#define DRAWINGGUI_QGRAPHICSITEMCMARK_H | ||
|
||
# include "QGIVertex.h" | ||
|
||
namespace TechDrawGui | ||
{ | ||
|
||
class TechDrawGuiExport QGICMark : public QGIVertex | ||
{ | ||
public: | ||
explicit QGICMark(int index); | ||
~QGICMark() {} | ||
|
||
enum {Type = QGraphicsItem::UserType + 171}; | ||
int type() const { return Type;} | ||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); | ||
|
||
int getProjIndex() const { return projIndex; } | ||
|
||
void draw(void); | ||
float getSize() { return m_size; } | ||
void setSize(float s); | ||
float getThick() { return m_thick; } | ||
void setThick(float t); | ||
virtual void setPrettyNormal(); | ||
|
||
protected: | ||
int projIndex; | ||
QColor getCMarkColor(); | ||
|
||
private: | ||
float m_size; | ||
float m_thick; | ||
}; | ||
|
||
} | ||
|
||
#endif // DRAWINGGUI_QGRAPHICSITEMCMARK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters