From: Shamus Hammons Date: Wed, 4 Aug 2010 03:48:21 +0000 (+0000) Subject: Removed useless *Listener class and references. X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d86611a87f46873819dfae63f1112b248ba9aca1;p=architektonas Removed useless *Listener class and references. --- diff --git a/architektonas.pro b/architektonas.pro index 3a8b72a..ede199f 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -33,7 +33,6 @@ HEADERS = \ src/base/rs_atomicentity.h \ src/base/rs_block.h \ src/base/rs_blocklist.h \ - src/base/rs_blocklistlistener.h \ src/base/rs_circle.h \ src/base/rs_clipboard.h \ src/base/rs_color.h \ @@ -73,7 +72,6 @@ HEADERS = \ src/base/rs_insert.h \ src/base/rs_layer.h \ src/base/rs_layerlist.h \ - src/base/rs_layerlistlistener.h \ src/base/rs_leader.h \ src/base/rs_line.h \ src/base/rs_linetypepattern.h \ @@ -140,6 +138,7 @@ SOURCES = \ src/base/rs_filterdxf.cpp \ src/base/rs_filterdxf1.cpp \ src/base/rs_filterinterface.cpp \ + src/base/rs_flags.cpp \ src/base/rs_font.cpp \ src/base/rs_fontlist.cpp \ src/base/rs_grid.cpp \ diff --git a/src/base/drawing.cpp b/src/base/drawing.cpp index 3393bfc..a891bd4 100644 --- a/src/base/drawing.cpp +++ b/src/base/drawing.cpp @@ -302,6 +302,7 @@ void Drawing::freezeAllLayers(bool freeze) layerList.freezeAll(freeze); } +#if 0 void Drawing::addLayerListListener(RS_LayerListListener * listener) { layerList.addListener(listener); @@ -311,6 +312,7 @@ void Drawing::removeLayerListListener(RS_LayerListListener * listener) { layerList.removeListener(listener); } +#endif // Wrapper for block functions: @@ -384,6 +386,7 @@ void Drawing::freezeAllBlocks(bool freeze) blockList.freezeAll(freeze); } +#if 0 void Drawing::addBlockListListener(RS_BlockListListener * listener) { blockList.addListener(listener); @@ -393,6 +396,7 @@ void Drawing::removeBlockListListener(RS_BlockListListener * listener) { blockList.removeListener(listener); } +#endif // Wrappers for variable functions: void Drawing::clearVariables() @@ -462,6 +466,7 @@ QMultiHash & Drawing::getVariableDict() bool Drawing::isGridOn() { int on = getVariableInt("$GRIDMODE", 1); + return (on != 0); } @@ -479,9 +484,7 @@ void Drawing::setGridOn(bool on) void Drawing::setUnit(RS2::Unit u) { setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u)); - addVariable("$INSUNITS", (int)u, 70); - //unit = u; } @@ -606,7 +609,6 @@ void Drawing::setPaperInsertionBase(const Vector & p) Vector Drawing::getPaperSize() { Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit()); - Vector v1 = getVariableVector("$PLIMMIN", Vector(0.0, 0.0)); Vector v2 = getVariableVector("$PLIMMAX", def); @@ -753,8 +755,8 @@ std::ostream & operator<<(std::ostream & os, Drawing & g) os << "--- Drawing: \n"; os << "---" << *g.getLayerList() << "\n"; os << "---" << *g.getBlockList() << "\n"; - os << "---" << (RS_Undo&)g << "\n"; - os << "---" << (RS_EntityContainer&)g << "\n"; + os << "---" << (RS_Undo &)g << "\n"; + os << "---" << (RS_EntityContainer &)g << "\n"; return os; } diff --git a/src/base/drawing.h b/src/base/drawing.h index 22b2217..a794474 100644 --- a/src/base/drawing.h +++ b/src/base/drawing.h @@ -18,114 +18,105 @@ */ class Drawing: public RS_Document { -public: - Drawing(RS_EntityContainer * parent = NULL); - virtual ~Drawing(); - - virtual RS2::EntityType rtti() const; - virtual unsigned long int countLayerEntities(RS_Layer * layer); - virtual RS_LayerList * getLayerList(); - virtual RS_BlockList * getBlockList(); - virtual void newDoc(); - virtual bool save(); - virtual bool saveAs(const QString& filename, RS2::FormatType type); - virtual bool open(const QString& filename, RS2::FormatType type); - - // Wrappers for Layer functions: - void clearLayers(); - uint countLayers() const; - RS_Layer * layerAt(uint i); - void activateLayer(const QString & name); - void activateLayer(RS_Layer * layer); - RS_Layer * getActiveLayer(); - virtual void addLayer(RS_Layer * layer); - virtual void removeLayer(RS_Layer * layer); - virtual void editLayer(RS_Layer * layer, const RS_Layer & source); - RS_Layer * findLayer(const QString & name); - void toggleLayer(const QString & name); - void toggleLayer(RS_Layer * layer); - void toggleLayerLock(RS_Layer * layer); - void freezeAllLayers(bool freeze); - void addLayerListListener(RS_LayerListListener * listener); - void removeLayerListListener(RS_LayerListListener * listener); - - // Wrapper for block functions: - void clearBlocks(); - uint countBlocks(); - RS_Block * blockAt(uint i); - void activateBlock(const QString & name); - void activateBlock(RS_Block * block); - RS_Block * getActiveBlock(); - virtual bool addBlock(RS_Block * block, bool notify = true); - virtual void addBlockNotification(); - virtual void removeBlock(RS_Block * block); - RS_Block * findBlock(const QString & name); - QString newBlockName(); - void toggleBlock(const QString & name); - void toggleBlock(RS_Block * block); - void freezeAllBlocks(bool freeze); - void addBlockListListener(RS_BlockListListener * listener); - void removeBlockListListener(RS_BlockListListener * listener); - - // Wrappers for variable functions: - void clearVariables(); - int countVariables(); - void addVariable(const QString & key, const Vector & value, int code); - void addVariable(const QString & key, const QString & value, int code); - void addVariable(const QString & key, int value, int code); - void addVariable(const QString & key, double value, int code); - Vector getVariableVector(const QString & key, const Vector & def); - QString getVariableString(const QString & key, const QString & def); - int getVariableInt(const QString & key, int def); - double getVariableDouble(const QString & key, double def); - void removeVariable(const QString & key); -// Q3Dict & getVariableDict(); - QMultiHash & getVariableDict(); - - RS2::LinearFormat getLinearFormat(); - int getLinearPrecision(); - RS2::AngleFormat getAngleFormat(); - int getAnglePrecision(); - - Vector getPaperSize(); - void setPaperSize(const Vector & s); - - Vector getPaperInsertionBase(); - void setPaperInsertionBase(const Vector & p); - - RS2::PaperFormat getPaperFormat(bool * landscape); - void setPaperFormat(RS2::PaperFormat f, bool landscape); - - double getPaperScale(); - void setPaperScale(double s); - - virtual void setUnit(RS2::Unit u); - virtual RS2::Unit getUnit(); - - bool isGridOn(); - void setGridOn(bool on); - - bool isDraftOn(); - void setDraftOn(bool on); - - void centerToPage(); - void fitToPage(); - virtual bool isModified() const; - virtual void setModified(bool m); - + public: + Drawing(RS_EntityContainer * parent = NULL); + virtual ~Drawing(); + + virtual RS2::EntityType rtti() const; + virtual unsigned long int countLayerEntities(RS_Layer * layer); + virtual RS_LayerList * getLayerList(); + virtual RS_BlockList * getBlockList(); + virtual void newDoc(); + virtual bool save(); + virtual bool saveAs(const QString& filename, RS2::FormatType type); + virtual bool open(const QString& filename, RS2::FormatType type); + + // Wrappers for Layer functions: + void clearLayers(); + uint countLayers() const; + RS_Layer * layerAt(uint i); + void activateLayer(const QString & name); + void activateLayer(RS_Layer * layer); + RS_Layer * getActiveLayer(); + virtual void addLayer(RS_Layer * layer); + virtual void removeLayer(RS_Layer * layer); + virtual void editLayer(RS_Layer * layer, const RS_Layer & source); + RS_Layer * findLayer(const QString & name); + void toggleLayer(const QString & name); + void toggleLayer(RS_Layer * layer); + void toggleLayerLock(RS_Layer * layer); + void freezeAllLayers(bool freeze); +// void addLayerListListener(RS_LayerListListener * listener); +// void removeLayerListListener(RS_LayerListListener * listener); + + // Wrapper for block functions: + void clearBlocks(); + uint countBlocks(); + RS_Block * blockAt(uint i); + void activateBlock(const QString & name); + void activateBlock(RS_Block * block); + RS_Block * getActiveBlock(); + virtual bool addBlock(RS_Block * block, bool notify = true); + virtual void addBlockNotification(); + virtual void removeBlock(RS_Block * block); + RS_Block * findBlock(const QString & name); + QString newBlockName(); + void toggleBlock(const QString & name); + void toggleBlock(RS_Block * block); + void freezeAllBlocks(bool freeze); +// void addBlockListListener(RS_BlockListListener * listener); +// void removeBlockListListener(RS_BlockListListener * listener); + + // Wrappers for variable functions: + void clearVariables(); + int countVariables(); + void addVariable(const QString & key, const Vector & value, int code); + void addVariable(const QString & key, const QString & value, int code); + void addVariable(const QString & key, int value, int code); + void addVariable(const QString & key, double value, int code); + Vector getVariableVector(const QString & key, const Vector & def); + QString getVariableString(const QString & key, const QString & def); + int getVariableInt(const QString & key, int def); + double getVariableDouble(const QString & key, double def); + void removeVariable(const QString & key); + // Q3Dict & getVariableDict(); + QMultiHash & getVariableDict(); + + RS2::LinearFormat getLinearFormat(); + int getLinearPrecision(); + RS2::AngleFormat getAngleFormat(); + int getAnglePrecision(); + Vector getPaperSize(); + void setPaperSize(const Vector & s); + Vector getPaperInsertionBase(); + void setPaperInsertionBase(const Vector & p); + RS2::PaperFormat getPaperFormat(bool * landscape); + void setPaperFormat(RS2::PaperFormat f, bool landscape); + double getPaperScale(); + void setPaperScale(double s); + virtual void setUnit(RS2::Unit u); + virtual RS2::Unit getUnit(); + bool isGridOn(); + void setGridOn(bool on); + bool isDraftOn(); + void setDraftOn(bool on); + void centerToPage(); + void fitToPage(); + virtual bool isModified() const; + virtual void setModified(bool m); #ifdef RS_CAM - RS_CamData & getCamData(); - void setCamData(const RS_CamData & d); + RS_CamData & getCamData(); + void setCamData(const RS_CamData & d); #endif - friend std::ostream & operator<<(std::ostream & os, Drawing & g); + friend std::ostream & operator<<(std::ostream & os, Drawing & g); -private: - RS_LayerList layerList; - RS_BlockList blockList; - RS_VariableDict variableDict; + private: + RS_LayerList layerList; + RS_BlockList blockList; + RS_VariableDict variableDict; #ifdef RS_CAM - RS_CamData camData; + RS_CamData camData; #endif }; diff --git a/src/base/rs_arc.cpp b/src/base/rs_arc.cpp index 60755a2..5fac581 100644 --- a/src/base/rs_arc.cpp +++ b/src/base/rs_arc.cpp @@ -18,10 +18,11 @@ #include "rs_arc.h" #include "rs_constructionline.h" +#include "rs_debug.h" +#include "graphicview.h" #include "rs_linetypepattern.h" #include "rs_information.h" #include "rs_math.h" -#include "graphicview.h" #include "paintinterface.h" /** diff --git a/src/base/rs_blocklist.cpp b/src/base/rs_blocklist.cpp index 8a16a1a..76e78e9 100644 --- a/src/base/rs_blocklist.cpp +++ b/src/base/rs_blocklist.cpp @@ -16,6 +16,8 @@ #include "rs_blocklist.h" +#include "rs_debug.h" + /** * Constructor. * @@ -148,11 +150,13 @@ bool RS_BlockList::add(RS_Block * block, bool notify) */ void RS_BlockList::addNotification() { +#if 0 for(int i=0; iblockAdded(NULL); } +#endif } /** @@ -168,11 +172,13 @@ void RS_BlockList::remove(RS_Block * block) // blocks.remove(block); blocks.removeAll(block); +#if 0 for(int i=0; iblockRemoved(block); } +#endif setModified(true); @@ -288,6 +294,7 @@ void RS_BlockList::toggle(RS_Block * block) block->toggle(); +#if 0 // Notify listeners: for(int i=0; iblockToggled(block); } +#endif } /** @@ -307,11 +315,13 @@ void RS_BlockList::freezeAll(bool freeze) for(uint l=0; lfreeze(freeze); +#if 0 for(int i=0; iblockToggled(NULL); } +#endif } /** @@ -336,6 +346,7 @@ void RS_BlockList::toggleBlock(const QString& name) { * adds a BlockListListener to the list of listeners. Listeners * are notified when the block list changes. */ +#if 0 void RS_BlockList::addListener(RS_BlockListListener * listener) { blockListListeners.append(listener); @@ -346,9 +357,9 @@ void RS_BlockList::addListener(RS_BlockListListener * listener) */ void RS_BlockList::removeListener(RS_BlockListListener * listener) { -// blockListListeners.remove(listener); blockListListeners.removeAll(listener); } +#endif /** * Sets the layer lists modified status to 'm'. @@ -383,4 +394,3 @@ std::ostream & operator<<(std::ostream & os, RS_BlockList & b) return os; } - diff --git a/src/base/rs_blocklist.h b/src/base/rs_blocklist.h index fecaef0..ed1dc8c 100644 --- a/src/base/rs_blocklist.h +++ b/src/base/rs_blocklist.h @@ -3,7 +3,7 @@ #include #include "rs_block.h" -#include "rs_blocklistlistener.h" +//#include "rs_blocklistlistener.h" #include "rs_entity.h" /** @@ -22,11 +22,9 @@ class RS_BlockList void clear(); uint count(); RS_Block * at(uint i); - void activate(const QString & name); void activate(RS_Block * block); RS_Block * getActive(); - virtual bool add(RS_Block * block, bool notify = true); virtual void addNotification(); virtual void remove(RS_Block * block); @@ -37,10 +35,8 @@ class RS_BlockList void toggle(const QString & name); void toggle(RS_Block * block); void freezeAll(bool freeze); - - void addListener(RS_BlockListListener * listener); - void removeListener(RS_BlockListListener * listener); - +// void addListener(RS_BlockListListener * listener); +// void removeListener(RS_BlockListListener * listener); void setModified(bool m); virtual bool isModified() const; @@ -50,11 +46,9 @@ class RS_BlockList //! Is the list owning the blocks? bool owner; //! Blocks in the graphic -// Q3PtrList blocks; QList blocks; //! List of registered BlockListListeners -// Q3PtrList blockListListeners; - QList blockListListeners; +// QList blockListListeners; //! Currently active block RS_Block * activeBlock; /** Flag set if the layer list was modified and not yet saved. */ diff --git a/src/base/rs_blocklistlistener.h b/src/base/rs_blocklistlistener.h deleted file mode 100644 index 2581f92..0000000 --- a/src/base/rs_blocklistlistener.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef RS_BLOCKLISTLISTENER_H -#define RS_BLOCKLISTLISTENER_H - -#include "rs_block.h" - -/** - * This class is an interface for classes that are interested in - * knowing about changes in the block list. - */ -class RS_BlockListListener -{ - public: - RS_BlockListListener() {} - virtual ~RS_BlockListListener() {} - - /** - * Called when the active block changes. - */ - virtual void blockActivated(RS_Block*) {} - - /** - * Called when a new block is added to the list. - */ - virtual void blockAdded(RS_Block*) {} - - /** - * Called when a block is removed from the list. - */ - virtual void blockRemoved(RS_Block*) {} - - /** - * Called when a block's attributes are modified. - */ - virtual void blockEdited(RS_Block*) {} - - /** - * Called when a block's visibility is toggled. - */ - virtual void blockToggled(RS_Block*) {} -}; - -#endif diff --git a/src/base/rs_circle.cpp b/src/base/rs_circle.cpp index 3291451..563c42a 100644 --- a/src/base/rs_circle.cpp +++ b/src/base/rs_circle.cpp @@ -17,9 +17,10 @@ #include "rs_circle.h" #include "rs_constructionline.h" +#include "rs_debug.h" +#include "graphicview.h" #include "rs_information.h" #include "rs_linetypepattern.h" -#include "graphicview.h" #include "paintinterface.h" /** diff --git a/src/base/rs_color.cpp b/src/base/rs_color.cpp index 6fd4096..14d7961 100644 --- a/src/base/rs_color.cpp +++ b/src/base/rs_color.cpp @@ -16,6 +16,8 @@ #include "rs_color.h" +#include "rs.h" + RS_Color::RS_Color(): QColor(), RS_Flags() { } diff --git a/src/base/rs_document.cpp b/src/base/rs_document.cpp index b4aa5cb..8279b38 100644 --- a/src/base/rs_document.cpp +++ b/src/base/rs_document.cpp @@ -16,6 +16,8 @@ #include "rs_document.h" +#include "rs_debug.h" + /** * Constructor. * diff --git a/src/base/rs_flags.h b/src/base/rs_flags.h index ab32848..e127a40 100644 --- a/src/base/rs_flags.h +++ b/src/base/rs_flags.h @@ -1,9 +1,6 @@ #ifndef RS_FLAGS_H #define RS_FLAGS_H -#include "rs.h" -#include "rs_debug.h" - /** * Base class for objects which have flags. * @@ -11,53 +8,21 @@ */ class RS_Flags { -public: - /** Default constructor. Resets all flags to 0. */ - RS_Flags() { - flags = 0; - } - - /** Constructor with initialisation to the given flags. */ - RS_Flags(unsigned int f) { - flags = f; - } - - virtual ~RS_Flags() {} - - unsigned int getFlags() const { - return flags; - } - - void resetFlags() { - flags=0; - } - - void setFlags(unsigned int f) { - flags=f; - } - - void setFlag(unsigned int f) { - flags=flags|f; - } - - void delFlag(unsigned int f) { - flags=flags&(~f); - } - - void toggleFlag(unsigned int f) { - flags=flags^f; - } - - bool getFlag(unsigned int f) const { - if(flags&f) { - return true; - } else { - return false; - } - } - -private: - unsigned int flags; + public: + RS_Flags(); + RS_Flags(unsigned int f); + virtual ~RS_Flags(); + + unsigned int getFlags() const; + void resetFlags(); + void setFlags(unsigned int f); + void setFlag(unsigned int f); + void delFlag(unsigned int f); + void toggleFlag(unsigned int f) ; + bool getFlag(unsigned int f) const; + + private: + unsigned int flags; }; #endif diff --git a/src/base/rs_infoarea.h b/src/base/rs_infoarea.h index 31f3738..4bc2fb2 100644 --- a/src/base/rs_infoarea.h +++ b/src/base/rs_infoarea.h @@ -27,8 +27,6 @@ class RS_InfoArea private: double calcSubArea(const Vector & p1, const Vector & p2); - -// Q3ValueVector thePoints; QVector thePoints; double baseY; double area; diff --git a/src/base/rs_information.cpp b/src/base/rs_information.cpp index c836a2f..54a3180 100644 --- a/src/base/rs_information.cpp +++ b/src/base/rs_information.cpp @@ -17,6 +17,7 @@ #include "rs_information.h" #include "rs_constructionline.h" +#include "rs_debug.h" /** * Default constructor. @@ -36,33 +37,36 @@ RS_Information::RS_Information(RS_EntityContainer& container) */ bool RS_Information::isDimension(RS2::EntityType type) { - if (type==RS2::EntityDimAligned || - type==RS2::EntityDimLinear || - type==RS2::EntityDimRadial || - type==RS2::EntityDimDiametric || - type==RS2::EntityDimAngular) { - return true; - } else { - return false; - } + if (type == RS2::EntityDimAligned || type == RS2::EntityDimLinear + || type == RS2::EntityDimRadial || type == RS2::EntityDimDiametric + || type == RS2::EntityDimAngular) + { + return true; + } + else + { + return false; + } } - - /** * @retval true the entity can be trimmed. * i.e. it is in a graphic or in a polyline. */ -bool RS_Information::isTrimmable(RS_Entity* e) { - if (e!=NULL) { - if (e->getParent()!=NULL) { - if (e->getParent()->rtti()==RS2::EntityPolyline) { +bool RS_Information::isTrimmable(RS_Entity * e) +{ + if (e) + { + if (e->getParent()) + { + if (e->getParent()->rtti() == RS2::EntityPolyline) + { return true; } - else if (e->getParent()->rtti()==RS2::EntityContainer || - e->getParent()->rtti()==RS2::EntityGraphic || - e->getParent()->rtti()==RS2::EntityBlock) { - + else if (e->getParent()->rtti() == RS2::EntityContainer + || e->getParent()->rtti() == RS2::EntityGraphic + || e->getParent()->rtti() == RS2::EntityBlock) + { // normal entity: return true; } @@ -72,54 +76,58 @@ bool RS_Information::isTrimmable(RS_Entity* e) { return false; } - /** * @retval true the two entities can be trimmed to each other; * i.e. they are in a graphic or in the same polyline. */ -bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) { - if (e1!=NULL && e2!=NULL) { - if (e1->getParent()!=NULL && e2->getParent()!=NULL) { - if (e1->getParent()->rtti()==RS2::EntityPolyline && - e2->getParent()->rtti()==RS2::EntityPolyline && - e1->getParent()==e2->getParent()) { - +bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2) +{ + if (e1 && e2) + { + if (e1->getParent() && e2->getParent()) + { + if (e1->getParent()->rtti() == RS2::EntityPolyline + && e2->getParent()->rtti() == RS2::EntityPolyline + && e1->getParent()==e2->getParent()) + { // in the same polyline - RS_EntityContainer* pl = e1->getParent(); + RS_EntityContainer * pl = e1->getParent(); int idx1 = pl->findEntity(e1); int idx2 = pl->findEntity(e2); - RS_DEBUG->print("RS_Information::isTrimmable: " - "idx1: %d, idx2: %d", idx1, idx2); - if (abs(idx1-idx2)==1 || abs(idx1-idx2)==pl->count()-1) { + RS_DEBUG->print("RS_Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2); + + if (abs(idx1 - idx2) == 1 || abs(idx1 - idx2) == pl->count() - 1) + { // directly following entities return true; } - else { + else + { // not directly following entities return false; } } - else if ((e1->getParent()->rtti()==RS2::EntityContainer || - e1->getParent()->rtti()==RS2::EntityGraphic || - e1->getParent()->rtti()==RS2::EntityBlock) && - (e2->getParent()->rtti()==RS2::EntityContainer || - e2->getParent()->rtti()==RS2::EntityGraphic || - e2->getParent()->rtti()==RS2::EntityBlock)) { - + else if ((e1->getParent()->rtti() == RS2::EntityContainer + || e1->getParent()->rtti() == RS2::EntityGraphic + || e1->getParent()->rtti() == RS2::EntityBlock) + && (e2->getParent()->rtti() == RS2::EntityContainer + || e2->getParent()->rtti() == RS2::EntityGraphic + || e2->getParent()->rtti() == RS2::EntityBlock)) + { // normal entities: return true; } } - else { + else + { // independent entities with the same parent: - return (e1->getParent()==e2->getParent()); + return (e1->getParent() == e2->getParent()); } } return false; } - /** * Gets the nearest end point to the given coordinate. * @@ -129,12 +137,11 @@ bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) { * if there are no elements at all in this graphics * container. */ -Vector RS_Information::getNearestEndpoint(const Vector& coord, - double* dist) const { - return container->getNearestEndpoint(coord, dist); +Vector RS_Information::getNearestEndpoint(const Vector & coord, double * dist) const +{ + return container->getNearestEndpoint(coord, dist); } - /** * Gets the nearest point to the given coordinate which is on an entity. * @@ -148,15 +155,12 @@ Vector RS_Information::getNearestEndpoint(const Vector& coord, * if there are no elements at all in this graphics * container. */ -Vector RS_Information::getNearestPointOnEntity(const Vector& coord, - bool onEntity, - double* dist, - RS_Entity** entity) const { - - return container->getNearestPointOnEntity(coord, onEntity, dist, entity); +Vector RS_Information::getNearestPointOnEntity(const Vector & coord, + bool onEntity, double * dist, RS_Entity ** entity) const +{ + return container->getNearestPointOnEntity(coord, onEntity, dist, entity); } - /** * Gets the nearest entity to the given coordinate. * @@ -168,15 +172,12 @@ Vector RS_Information::getNearestPointOnEntity(const Vector& coord, * @return the entity found or NULL if there are no elements * at all in this graphics container. */ -RS_Entity* RS_Information::getNearestEntity(const Vector& coord, - double* dist, - RS2::ResolveLevel level) const { - - return container->getNearestEntity(coord, dist, level); +RS_Entity * RS_Information::getNearestEntity(const Vector & coord, + double * dist, RS2::ResolveLevel level) const +{ + return container->getNearestEntity(coord, dist, level); } - - /** * Calculates the intersection point(s) between two entities. * @@ -189,478 +190,456 @@ RS_Entity* RS_Information::getNearestEntity(const Vector& coord, * @return All intersections of the two entities. The tangent flag in * VectorSolutions is set if one intersection is a tangent point. */ -VectorSolutions RS_Information::getIntersection(RS_Entity* e1, - RS_Entity* e2, bool onEntities) { - - VectorSolutions ret; +VectorSolutions RS_Information::getIntersection(RS_Entity * e1, + RS_Entity * e2, bool onEntities) +{ + VectorSolutions ret; double tol = 1.0e-4; - if (e1==NULL || e2==NULL) { - return ret; - } - - // unsupported entities / entity combinations: - if ((e1->rtti()==RS2::EntityEllipse && e2->rtti()==RS2::EntityEllipse) || - e1->rtti()==RS2::EntityText || e2->rtti()==RS2::EntityText || - isDimension(e1->rtti()) || isDimension(e2->rtti())) { - - return ret; - } - - // (only) one entity is an ellipse: - if (e1->rtti()==RS2::EntityEllipse || e2->rtti()==RS2::EntityEllipse) { - if (e2->rtti()==RS2::EntityEllipse) { - RS_Entity* tmp = e1; - e1 = e2; - e2 = tmp; - } - if (e2->rtti()==RS2::EntityLine) { - RS_Ellipse* ellipse = (RS_Ellipse*)e1; - ret = getIntersectionLineEllipse((RS_Line*)e2, ellipse); - tol = 1.0e-1; - } + if (!e1 || !e2) + return ret; + // unsupported entities / entity combinations: + if ((e1->rtti() == RS2::EntityEllipse && e2->rtti() == RS2::EntityEllipse) + || e1->rtti() == RS2::EntityText || e2->rtti() == RS2::EntityText + || isDimension(e1->rtti()) || isDimension(e2->rtti())) + { + return ret; + } + + // (only) one entity is an ellipse: + if (e1->rtti() == RS2::EntityEllipse || e2->rtti() == RS2::EntityEllipse) + { + if (e2->rtti() == RS2::EntityEllipse) + { + RS_Entity * tmp = e1; + e1 = e2; + e2 = tmp; + } + + if (e2->rtti() == RS2::EntityLine) + { + RS_Ellipse * ellipse = (RS_Ellipse *)e1; + ret = getIntersectionLineEllipse((RS_Line *)e2, ellipse); + tol = 1.0e-1; + } // ellipse / arc, ellipse / ellipse: not supported: - else { - return ret; - } - } else { + else + { + return ret; + } + } + else + { + RS_Entity * te1 = e1; + RS_Entity * te2 = e2; + + // entity copies - so we only have to deal with lines and arcs + RS_Line l1(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); + RS_Line l2(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0))); + + RS_Arc a1(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); + RS_Arc a2(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false)); + + // convert construction lines to lines: + if (e1->rtti() == RS2::EntityConstructionLine) + { + RS_ConstructionLine * cl = (RS_ConstructionLine *)e1; + l1.setStartpoint(cl->getPoint1()); + l1.setEndpoint(cl->getPoint2()); + te1 = &l1; + } - RS_Entity* te1 = e1; - RS_Entity* te2 = e2; + if (e2->rtti() == RS2::EntityConstructionLine) + { + RS_ConstructionLine * cl = (RS_ConstructionLine *)e2; + l2.setStartpoint(cl->getPoint1()); + l2.setEndpoint(cl->getPoint2()); + te2 = &l2; + } - // entity copies - so we only have to deal with lines and arcs - RS_Line l1(NULL, - RS_LineData(Vector(0.0, 0.0), Vector(0.0,0.0))); - RS_Line l2(NULL, - RS_LineData(Vector(0.0, 0.0), Vector(0.0,0.0))); + // convert circles to arcs: + if (e1->rtti() == RS2::EntityCircle) + { + RS_Circle * c = (RS_Circle *)e1; + RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); + a1.setData(data); + te1 = &a1; + } - RS_Arc a1(NULL, - RS_ArcData(Vector(0.0,0.0), 1.0, 0.0, 2*M_PI, false)); - RS_Arc a2(NULL, - RS_ArcData(Vector(0.0,0.0), 1.0, 0.0, 2*M_PI, false)); + if (e2->rtti() == RS2::EntityCircle) + { + RS_Circle * c = (RS_Circle *)e2; + RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false); + a2.setData(data); + te2 = &a2; + } - // convert construction lines to lines: - if (e1->rtti()==RS2::EntityConstructionLine) { - RS_ConstructionLine* cl = (RS_ConstructionLine*)e1; - - l1.setStartpoint(cl->getPoint1()); - l1.setEndpoint(cl->getPoint2()); - - te1 = &l1; - } - if (e2->rtti()==RS2::EntityConstructionLine) { - RS_ConstructionLine* cl = (RS_ConstructionLine*)e2; - - l2.setStartpoint(cl->getPoint1()); - l2.setEndpoint(cl->getPoint2()); - - te2 = &l2; - } - - - // convert circles to arcs: - if (e1->rtti()==RS2::EntityCircle) { - RS_Circle* c = (RS_Circle*)e1; - - RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2*M_PI, false); - a1.setData(data); - - te1 = &a1; - } - if (e2->rtti()==RS2::EntityCircle) { - RS_Circle* c = (RS_Circle*)e2; - - RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2*M_PI, false); - a2.setData(data); - - te2 = &a2; - } - - - // line / line: - // - //else - if (te1->rtti()==RS2::EntityLine && - te2->rtti()==RS2::EntityLine) { - - RS_Line* line1 = (RS_Line*)te1; - RS_Line* line2 = (RS_Line*)te2; - - ret = getIntersectionLineLine(line1, line2); - } - - // line / arc: - // - else if (te1->rtti()==RS2::EntityLine && - te2->rtti()==RS2::EntityArc) { - - RS_Line* line = (RS_Line*)te1; - RS_Arc* arc = (RS_Arc*)te2; - - ret = getIntersectionLineArc(line, arc); - } - - // arc / line: - // - else if (te1->rtti()==RS2::EntityArc && - te2->rtti()==RS2::EntityLine) { - - RS_Arc* arc = (RS_Arc*)te1; - RS_Line* line = (RS_Line*)te2; - - ret = getIntersectionLineArc(line, arc); - } - - // arc / arc: - // - else if (te1->rtti()==RS2::EntityArc && - te2->rtti()==RS2::EntityArc) { - - RS_Arc* arc1 = (RS_Arc*)te1; - RS_Arc* arc2 = (RS_Arc*)te2; - - ret = getIntersectionArcArc(arc1, arc2); - } else { - RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type."); - } - } - - - // Check all intersection points for being on entities: - // - if (onEntities==true) { - if (!e1->isPointOnEntity(ret.get(0), tol) || - !e2->isPointOnEntity(ret.get(0), tol)) { - ret.set(0, Vector(false)); - } - if (!e1->isPointOnEntity(ret.get(1), tol) || - !e2->isPointOnEntity(ret.get(1), tol)) { - ret.set(1, Vector(false)); - } - if (!e1->isPointOnEntity(ret.get(2), tol) || - !e2->isPointOnEntity(ret.get(2), tol)) { - ret.set(2, Vector(false)); - } - if (!e1->isPointOnEntity(ret.get(3), tol) || - !e2->isPointOnEntity(ret.get(3), tol)) { - ret.set(3, Vector(false)); - } - } - - int k=0; - for (int i=0; i<4; ++i) { - if (ret.get(i).valid) { - ret.set(k, ret.get(i)); - k++; - } - } - for (int i=k; i<4; ++i) { - ret.set(i, Vector(false)); - } - - return ret; -} + // line / line: + // + //else + if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityLine) + { + RS_Line * line1 = (RS_Line *)te1; + RS_Line * line2 = (RS_Line *)te2; + ret = getIntersectionLineLine(line1, line2); + } + // line / arc: + // + else if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityArc) + { + RS_Line * line = (RS_Line *)te1; + RS_Arc * arc = (RS_Arc *)te2; + ret = getIntersectionLineArc(line, arc); + } + // arc / line: + // + else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityLine) + { + RS_Arc * arc = (RS_Arc *)te1; + RS_Line * line = (RS_Line *)te2; + ret = getIntersectionLineArc(line, arc); + } + // arc / arc: + // + else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityArc) + { + RS_Arc * arc1 = (RS_Arc *)te1; + RS_Arc * arc2 = (RS_Arc *)te2; + ret = getIntersectionArcArc(arc1, arc2); + } + else + { + RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type."); + } + } + // Check all intersection points for being on entities: + // + if (onEntities) + { + if (!e1->isPointOnEntity(ret.get(0), tol) || !e2->isPointOnEntity(ret.get(0), tol)) + { + ret.set(0, Vector(false)); + } + if (!e1->isPointOnEntity(ret.get(1), tol) || !e2->isPointOnEntity(ret.get(1), tol)) + { + ret.set(1, Vector(false)); + } -/** - * @return Intersection between two lines. - */ -VectorSolutions RS_Information::getIntersectionLineLine(RS_Line* e1, - RS_Line* e2) { + if (!e1->isPointOnEntity(ret.get(2), tol) || !e2->isPointOnEntity(ret.get(2), tol)) + { + ret.set(2, Vector(false)); + } - VectorSolutions ret; + if (!e1->isPointOnEntity(ret.get(3), tol) || !e2->isPointOnEntity(ret.get(3), tol)) + { + ret.set(3, Vector(false)); + } + } - if (e1==NULL || e2==NULL) { - return ret; - } + int k = 0; + for(int i=0; i<4; ++i) + { + if (ret.get(i).valid) + { + ret.set(k, ret.get(i)); + k++; + } + } - Vector p1 = e1->getStartpoint(); - Vector p2 = e1->getEndpoint(); - Vector p3 = e2->getStartpoint(); - Vector p4 = e2->getEndpoint(); + for (int i=k; i<4; ++i) + { + ret.set(i, Vector(false)); + } - double num = ((p4.x-p3.x)*(p1.y-p3.y) - (p4.y-p3.y)*(p1.x-p3.x)); - double div = ((p4.y-p3.y)*(p2.x-p1.x) - (p4.x-p3.x)*(p2.y-p1.y)); + return ret; +} - if (fabs(div)>RS_TOLERANCE) { - double u = num / div; +/** + * @return Intersection between two lines. + */ +VectorSolutions RS_Information::getIntersectionLineLine(RS_Line * e1, RS_Line * e2) +{ + VectorSolutions ret; - double xs = p1.x + u * (p2.x-p1.x); - double ys = p1.y + u * (p2.y-p1.y); - ret = VectorSolutions(Vector(xs, ys)); - } + if (!e1 || !e2) + return ret; - // lines are parallel - else { - ret = VectorSolutions(); - } + Vector p1 = e1->getStartpoint(); + Vector p2 = e1->getEndpoint(); + Vector p3 = e2->getStartpoint(); + Vector p4 = e2->getEndpoint(); - return ret; -} + double num = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)); + double div = ((p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y)); + if (fabs(div) > RS_TOLERANCE) + { + double u = num / div; + double xs = p1.x + u * (p2.x - p1.x); + double ys = p1.y + u * (p2.y - p1.y); + ret = VectorSolutions(Vector(xs, ys)); + } + // lines are parallel + else + ret = VectorSolutions(); + return ret; +} /** * @return One or two intersection points between given entities. */ -VectorSolutions RS_Information::getIntersectionLineArc(RS_Line* line, - RS_Arc* arc) { - - VectorSolutions ret; - - if (line==NULL || arc==NULL) { - return ret; - } - - double dist=0.0; - Vector nearest; - nearest = line->getNearestPointOnEntity(arc->getCenter(), false, &dist); - - // special case: arc touches line (tangent): - if (fabs(dist - arc->getRadius()) < 1.0e-4) { - ret = VectorSolutions(nearest); - ret.setTangent(true); - return ret; - } - - Vector p = line->getStartpoint(); - Vector d = line->getEndpoint() - line->getStartpoint(); - if (d.magnitude()<1.0e-6) { - return ret; - } - - Vector c = arc->getCenter(); - double r = arc->getRadius(); - Vector delta = p - c; - - // root term: - double term = RS_Math::pow(Vector::dotP(d, delta), 2.0) - - RS_Math::pow(d.magnitude(), 2.0) - * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0)); - - // no intersection: - if (term<0.0) { - VectorSolutions s; - ret = s; - } - - // one or two intersections: - else { - double t1 = (- Vector::dotP(d, delta) + sqrt(term)) - / RS_Math::pow(d.magnitude(), 2.0); - double t2; - bool tangent = false; - - // only one intersection: - if (fabs(term)getNearestPointOnEntity(arc->getCenter(), false, &dist); + // special case: arc touches line (tangent): + if (fabs(dist - arc->getRadius()) < 1.0e-4) { + ret = VectorSolutions(nearest); + ret.setTangent(true); + return ret; + } -/** - * @return One or two intersection points between given entities. - */ -VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc* e1, - RS_Arc* e2) { + Vector p = line->getStartpoint(); + Vector d = line->getEndpoint() - line->getStartpoint(); + if (d.magnitude()<1.0e-6) { + return ret; + } + + Vector c = arc->getCenter(); + double r = arc->getRadius(); + Vector delta = p - c; - VectorSolutions ret; + // root term: + double term = RS_Math::pow(Vector::dotP(d, delta), 2.0) + - RS_Math::pow(d.magnitude(), 2.0) + * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0)); + + // no intersection: + if (term<0.0) { + VectorSolutions s; + ret = s; + } - if (e1==NULL || e2==NULL) { - return ret; - } + // one or two intersections: + else { + double t1 = (- Vector::dotP(d, delta) + sqrt(term)) + / RS_Math::pow(d.magnitude(), 2.0); + double t2; + bool tangent = false; + + // only one intersection: + if (fabs(term)getCenter(); - Vector c2 = e2->getCenter(); + ret = VectorSolutions(sol1, sol2); + ret.setTangent(tangent); + } - double r1 = e1->getRadius(); - double r2 = e2->getRadius(); + return ret; +} - Vector u = c2 - c1; +/** + * @return One or two intersection points between given entities. + */ +VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2) +{ + VectorSolutions ret; - // concentric - if (u.magnitude()<1.0e-6) { - return ret; - } + if (e1==NULL || e2==NULL) { + return ret; + } - Vector v = Vector(u.y, -u.x); + Vector c1 = e1->getCenter(); + Vector c2 = e2->getCenter(); - double s, t1, t2, term; + double r1 = e1->getRadius(); + double r2 = e2->getRadius(); - s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0); + Vector u = c2 - c1; - term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s; + // concentric + if (u.magnitude()<1.0e-6) { + return ret; + } - // no intersection: - if (term<0.0) { - ret = VectorSolutions(); - } + Vector v = Vector(u.y, -u.x); - // one or two intersections: - else { - t1 = sqrt(term); - t2 = -sqrt(term); - bool tangent = false; + double s, t1, t2, term; - Vector sol1 = c1 + u*s + v*t1; - Vector sol2 = c1 + u*s + v*t2; + s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0); - if (sol1.distanceTo(sol2)<1.0e-4) { - sol2 = Vector(false); - ret = VectorSolutions(sol1); - tangent = true; - } else { - ret = VectorSolutions(sol1, sol2); - } + term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s; - ret.setTangent(tangent); - } + // no intersection: + if (term<0.0) { + ret = VectorSolutions(); + } - return ret; -} + // one or two intersections: + else { + t1 = sqrt(term); + t2 = -sqrt(term); + bool tangent = false; + + Vector sol1 = c1 + u*s + v*t1; + Vector sol2 = c1 + u*s + v*t2; + + if (sol1.distanceTo(sol2)<1.0e-4) { + sol2 = Vector(false); + ret = VectorSolutions(sol1); + tangent = true; + } else { + ret = VectorSolutions(sol1, sol2); + } + ret.setTangent(tangent); + } + return ret; +} /** * @return One or two intersection points between given entities. */ -VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line, - RS_Ellipse* ellipse) { - - VectorSolutions ret; - - if (line==NULL || ellipse==NULL) { - return ret; - } - - // rotate into normal position: - double ang = ellipse->getAngle(); - - double rx = ellipse->getMajorRadius(); - double ry = ellipse->getMinorRadius(); - Vector center = ellipse->getCenter(); - Vector a1 = line->getStartpoint().rotate(center, -ang); - Vector a2 = line->getEndpoint().rotate(center, -ang); - Vector origin = a1; - Vector dir = a2-a1; - Vector diff = origin - center; - Vector mDir = Vector(dir.x/(rx*rx), dir.y/(ry*ry)); - Vector mDiff = Vector(diff.x/(rx*rx), diff.y/(ry*ry)); - - double a = Vector::dotP(dir, mDir); - double b = Vector::dotP(dir, mDiff); - double c = Vector::dotP(diff, mDiff) - 1.0; - double d = b*b - a*c; - - if (d < 0) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0"); - } else if ( d > 0 ) { - double root = sqrt(d); - double t_a = (-b - root) / a; - double t_b = (-b + root) / a; - - /*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) { - if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1"); - } - else { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1"); - } - } else {*/ - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1"); - Vector ret1(false); - Vector ret2(false); - //if ( 0 <= t_a && t_a <= 1 ) { - //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1"); - ret1 = a1.lerp(a2, t_a); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y); - //} - //if ( 0 <= t_b && t_b <= 1 ) { - //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1"); - ret2 = a1.lerp(a2, t_b); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y); - //} - if (ret1.valid && ret2.valid) { - ret = VectorSolutions(ret1, ret2); - } - else { - if (ret1.valid) { - ret = VectorSolutions(ret1); - } - if (ret2.valid) { - ret = VectorSolutions(ret2); - } - } - //} - } else { - double t = -b/a; - if ( 0 <= t && t <= 1 ) { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1"); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2"); - ret = VectorSolutions(a1.lerp(a2, t)); - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y); - } else { - RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2"); - } - } - - ret.rotate(center, ang); - return ret; - - - - /* - RS_Arc* arc = new RS_Arc(NULL, - RS_ArcData(ellipse->getCenter(), - ellipse->getMajorRadius(), - ellipse->getAngle1(), - ellipse->getAngle2(), - false)); - RS_Line* other = (RS_Line*)line->clone(); - double angle = ellipse->getAngle(); - //double ratio = ellipse->getRatio(); - - // rotate entities: - other->rotate(ellipse->getCenter(), -angle); - other->scale(ellipse->getCenter(), Vector(1.0, 1.0/ellipse->getRatio())); - - ret = getIntersectionLineArc(other, arc); - - ret.scale(ellipse->getCenter(), Vector(1.0, ellipse->getRatio())); - ret.rotate(ellipse->getCenter(), angle); - - delete arc; - delete other; - - return ret; - */ -} +VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse) +{ + VectorSolutions ret; + if (line==NULL || ellipse==NULL) { + return ret; + } + + // rotate into normal position: + double ang = ellipse->getAngle(); + + double rx = ellipse->getMajorRadius(); + double ry = ellipse->getMinorRadius(); + Vector center = ellipse->getCenter(); + Vector a1 = line->getStartpoint().rotate(center, -ang); + Vector a2 = line->getEndpoint().rotate(center, -ang); + Vector origin = a1; + Vector dir = a2-a1; + Vector diff = origin - center; + Vector mDir = Vector(dir.x/(rx*rx), dir.y/(ry*ry)); + Vector mDiff = Vector(diff.x/(rx*rx), diff.y/(ry*ry)); + + double a = Vector::dotP(dir, mDir); + double b = Vector::dotP(dir, mDiff); + double c = Vector::dotP(diff, mDiff) - 1.0; + double d = b*b - a*c; + + if (d < 0) { + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0"); + } else if ( d > 0 ) { + double root = sqrt(d); + double t_a = (-b - root) / a; + double t_b = (-b + root) / a; + + /*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) { + if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) { + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1"); + } + else { + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1"); + } + } else {*/ + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1"); + Vector ret1(false); + Vector ret2(false); + //if ( 0 <= t_a && t_a <= 1 ) { + //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1"); + ret1 = a1.lerp(a2, t_a); + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y); + //} + //if ( 0 <= t_b && t_b <= 1 ) { + //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1"); + ret2 = a1.lerp(a2, t_b); + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y); + //} + if (ret1.valid && ret2.valid) { + ret = VectorSolutions(ret1, ret2); + } + else { + if (ret1.valid) { + ret = VectorSolutions(ret1); + } + if (ret2.valid) { + ret = VectorSolutions(ret2); + } + } + //} + } else { + double t = -b/a; + if ( 0 <= t && t <= 1 ) { + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1"); + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2"); + ret = VectorSolutions(a1.lerp(a2, t)); + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y); + } else { + RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2"); + } + } + + ret.rotate(center, ang); + return ret; + + + + /* + RS_Arc* arc = new RS_Arc(NULL, + RS_ArcData(ellipse->getCenter(), + ellipse->getMajorRadius(), + ellipse->getAngle1(), + ellipse->getAngle2(), + false)); + RS_Line* other = (RS_Line*)line->clone(); + double angle = ellipse->getAngle(); + //double ratio = ellipse->getRatio(); + + // rotate entities: + other->rotate(ellipse->getCenter(), -angle); + other->scale(ellipse->getCenter(), Vector(1.0, 1.0/ellipse->getRatio())); + + ret = getIntersectionLineArc(other, arc); + + ret.scale(ellipse->getCenter(), Vector(1.0, ellipse->getRatio())); + ret.rotate(ellipse->getCenter(), angle); + + delete arc; + delete other; + + return ret; + */ +} /** * Checks if the given coordinate is inside the given contour. @@ -672,151 +651,175 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line, * @param onContour Will be set to true if the given point it exactly * on the contour. */ -bool RS_Information::isPointInsideContour(const Vector& point, - RS_EntityContainer* contour, bool* onContour) { - - if (contour==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, +bool RS_Information::isPointInsideContour(const Vector & point, + RS_EntityContainer * contour, bool * onContour) +{ + if (contour==NULL) { + RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Information::isPointInsideContour: contour is NULL"); - return false; - } - - if (point.x < contour->getMin().x || point.x > contour->getMax().x || - point.y < contour->getMin().y || point.y > contour->getMax().y) { - return false; - } - - double width = contour->getSize().x+1.0; - - bool sure; - int counter; - int tries = 0; - double rayAngle = 0.0; - do { - sure = true; - - // create ray: - Vector v; - v.setPolar(width*10.0, rayAngle); - RS_Line ray(NULL, RS_LineData(point, point+v)); - counter = 0; - VectorSolutions sol; - - if (onContour!=NULL) { - *onContour = false; - } - - for (RS_Entity* e = contour->firstEntity(RS2::ResolveAll); - e!=NULL; - e = contour->nextEntity(RS2::ResolveAll)) { - - // intersection(s) from ray with contour entity: - sol = RS_Information::getIntersection(&ray, e, true); - - for (int i=0; i<=1; ++i) { - Vector p = sol.get(i); - - if (p.valid) { - // point is on the contour itself - if (p.distanceTo(point)<1.0e-5) { - if (onContour!=NULL) { - *onContour = true; - } - } else { - if (e->rtti()==RS2::EntityLine) { - RS_Line* line = (RS_Line*)e; - - // ray goes through startpoint of line: - if (p.distanceTo(line->getStartpoint())<1.0e-4) { - if (RS_Math::correctAngle(line->getAngle1())getEndpoint())<1.0e-4) { - if (RS_Math::correctAngle(line->getAngle2())rtti()==RS2::EntityArc) { - RS_Arc* arc = (RS_Arc*)e; - - if (p.distanceTo(arc->getStartpoint())<1.0e-4) { - double dir = arc->getDirection1(); - if ((dir=1.0e-5) || - ((dir>2*M_PI-1.0e-5 || dir<1.0e-5) && - arc->getCenter().y>p.y)) { - counter++; - sure = false; - } - } - else if (p.distanceTo(arc->getEndpoint())<1.0e-4) { - double dir = arc->getDirection2(); - if ((dir=1.0e-5) || - ((dir>2*M_PI-1.0e-5 || dir<1.0e-5) && - arc->getCenter().y>p.y)) { - counter++; - sure = false; - } - } else { - counter++; - } - } else if (e->rtti()==RS2::EntityCircle) { - // tangent: - if (i==0 && sol.get(1).valid==false) { - if (!sol.isTangent()) { - counter++; - } else { - sure = false; - } - } else if (i==1 || sol.get(1).valid==true) { - counter++; - } - } - } - } - } - } - - rayAngle+=0.02; - tries++; - } - while (!sure && rayAngle<2*M_PI && tries<6); - - // remove double intersections: - /* - Q3PtrList is2; - bool done; - Vector* av; - do { - done = true; - double minDist = RS_MAXDOUBLE; - double dist; - av = NULL; - for (Vector* v = is.first(); v!=NULL; v = is.next()) { - dist = point.distanceTo(*v); - if (distgetMin().x || point.x > contour->getMax().x || + point.y < contour->getMin().y || point.y > contour->getMax().y) + return false; + + double width = contour->getSize().x+1.0; + bool sure; + int counter; + int tries = 0; + double rayAngle = 0.0; + + do + { + sure = true; + + // create ray: + Vector v; + v.setPolar(width*10.0, rayAngle); + RS_Line ray(NULL, RS_LineData(point, point+v)); + counter = 0; + VectorSolutions sol; + + if (onContour) + *onContour = false; + + for(RS_Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL; + e=contour->nextEntity(RS2::ResolveAll)) + { + // intersection(s) from ray with contour entity: + sol = RS_Information::getIntersection(&ray, e, true); + + for(int i=0; i<=1; ++i) + { + Vector p = sol.get(i); + + if (p.valid) + { + // point is on the contour itself + if (p.distanceTo(point) < 1.0e-5) + { + if (onContour) + { + *onContour = true; + } + } + else + { + if (e->rtti() == RS2::EntityLine) + { + RS_Line * line = (RS_Line *)e; + + // ray goes through startpoint of line: + if (p.distanceTo(line->getStartpoint()) < 1.0e-4) + { + if (RS_Math::correctAngle(line->getAngle1()) < M_PI) + { + counter++; + sure = false; + } + } + // ray goes through endpoint of line: + else if (p.distanceTo(line->getEndpoint()) < 1.0e-4) + { + if (RS_Math::correctAngle(line->getAngle2()) < M_PI) + { + counter++; + sure = false; + } + } + // ray goes through the line: + else + { + counter++; + } + } + else if (e->rtti() == RS2::EntityArc) + { + RS_Arc * arc = (RS_Arc *)e; + + if (p.distanceTo(arc->getStartpoint()) < 1.0e-4) + { + double dir = arc->getDirection1(); + + if ((dir < M_PI && dir >= 1.0e-5) + || ((dir > 2 * M_PI - 1.0e-5 || dir < 1.0e-5) + && arc->getCenter().y > p.y)) + { + counter++; + sure = false; + } + } + else if (p.distanceTo(arc->getEndpoint()) < 1.0e-4) + { + double dir = arc->getDirection2(); + + if ((dir < M_PI && dir >= 1.0e-5) + || ((dir > 2 * M_PI - 1.0e-5 || dir < 1.0e-5) + && arc->getCenter().y>p.y)) + { + counter++; + sure = false; + } + } + else + { + counter++; + } + } + else if (e->rtti() == RS2::EntityCircle) + { + // tangent: + if (i == 0 && sol.get(1).valid == false) + { + if (!sol.isTangent()) + { + counter++; + } + else + { + sure = false; + } + } + else if (i == 1 || sol.get(1).valid) + { + counter++; + } + } + } + } + } + } + + rayAngle += 0.02; + tries++; + } + while (!sure && rayAngle < 2 * M_PI && tries < 6); + + // remove double intersections: + /* + Q3PtrList is2; + bool done; + Vector* av; + do { + done = true; + double minDist = RS_MAXDOUBLE; + double dist; + av = NULL; + for (Vector* v = is.first(); v!=NULL; v = is.next()) { + dist = point.distanceTo(*v); + if (dist -#ifdef __hpux -#include -#endif +//#ifdef __hpux +//#include +//#endif #include #include diff --git a/src/base/rs_layerlist.cpp b/src/base/rs_layerlist.cpp index ac03f6e..56c169e 100644 --- a/src/base/rs_layerlist.cpp +++ b/src/base/rs_layerlist.cpp @@ -16,9 +16,10 @@ #include "rs_layerlist.h" -#include "rs_layer.h" -#include "rs_layerlistlistener.h" +//#include "rs_layerlistlistener.h" +#include "rs_debug.h" #include "rs_entity.h" +#include "rs_layer.h" /** * Default constructor. @@ -100,6 +101,7 @@ void RS_LayerList::activate(RS_Layer * layer, bool notify) activeLayer = layer; +#if 0 if (notify) { for(int i=0; iprint("RS_LayerList::activate listener notified"); } } +#endif RS_DEBUG->print("RS_LayerList::activate end"); } @@ -141,17 +144,19 @@ void RS_LayerList::add(RS_Layer * layer) { layers.append(layer); +#if 0 // notify listeners for(int i=0; ilayerAdded(layer); } +#endif setModified(true); // if there was no active layer so far, activate this one. - if (activeLayer ==NULL) + if (activeLayer == NULL) activate(layer); } else @@ -186,11 +191,13 @@ void RS_LayerList::remove(RS_Layer * layer) if (idx != -1) layers.takeAt(idx); +#if 0 for(int i=0; ilayerRemoved(layer); } +#endif setModified(true); @@ -209,16 +216,18 @@ void RS_LayerList::remove(RS_Layer * layer) */ void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source) { - if (layer == NULL) + if (!layer) return; *layer = source; +#if 0 for(int i=0; ilayerEdited(layer); } +#endif setModified(true); } @@ -233,7 +242,6 @@ RS_Layer * RS_LayerList::find(const QString & name) RS_Layer * ret = NULL; -// for(RS_Layer * l=layers.first(); l!=NULL; l=layers.next()) for(int i=0; itoggle(); +#if 0 // Notify listeners: for(int i=0; i < layerListListeners.count(); ++i) { RS_LayerListListener * l = layerListListeners.at(i); l->layerToggled(layer); } +#endif } /** @@ -351,17 +361,19 @@ void RS_LayerList::toggle(RS_Layer * layer) */ void RS_LayerList::toggleLock(RS_Layer * layer) { - if (layer == NULL) + if (!layer) return; layer->toggleLock(); +#if 0 // Notify listeners: for(int i=0; ilayerToggled(layer); } +#endif } /** @@ -374,13 +386,16 @@ void RS_LayerList::freezeAll(bool freeze) for(uint l=0; lfreeze(freeze); +#if 0 for(int i=0; ilayerToggled(NULL); } +#endif } +#if 0 /** * adds a LayerListListener to the list of listeners. Listeners * are notified when the layer list changes. @@ -404,6 +419,7 @@ void RS_LayerList::removeListener(RS_LayerListListener * listener) if (i != -1) layerListListeners.takeAt(i); } +#endif /** * Sets the layer lists modified status to 'm'. diff --git a/src/base/rs_layerlist.h b/src/base/rs_layerlist.h index 1a8a91e..0dcdfbd 100644 --- a/src/base/rs_layerlist.h +++ b/src/base/rs_layerlist.h @@ -5,7 +5,7 @@ #include class RS_Layer; -class RS_LayerListListener; +//class RS_LayerListListener; /** * A list of layers. @@ -34,8 +34,8 @@ class RS_LayerList void toggle(RS_Layer * layer); void toggleLock(RS_Layer * layer); void freezeAll(bool freeze); - void addListener(RS_LayerListListener * listener); - void removeListener(RS_LayerListListener * listener); +// void addListener(RS_LayerListListener * listener); +// void removeListener(RS_LayerListListener * listener); void setModified(bool m); virtual bool isModified() const; @@ -43,11 +43,9 @@ class RS_LayerList private: //! layers in the graphic -// Q3PtrList layers; QList layers; //! List of registered LayerListListeners -// Q3PtrList layerListListeners; - QList layerListListeners; +// QList layerListListeners; //! Currently active layer RS_Layer * activeLayer; /** Flag set if the layer list was modified and not yet saved. */ diff --git a/src/base/rs_layerlistlistener.h b/src/base/rs_layerlistlistener.h deleted file mode 100644 index 2164979..0000000 --- a/src/base/rs_layerlistlistener.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef RS_LAYERLISTLISTENER_H -#define RS_LAYERLISTLISTENER_H - -#include "rs_layer.h" - -/** - * This class is an interface for classes that are interested in - * knowing about changes in the layer list. - */ -class RS_LayerListListener -{ - public: - RS_LayerListListener() {} - virtual ~RS_LayerListListener() {} - - /** - * Called when the active layer changes. - */ - virtual void layerActivated(RS_Layer *) {} - - /** - * Called when a new layer is added to the list. - */ - virtual void layerAdded(RS_Layer *) {} - - /** - * Called when a layer is removed from the list. - */ - virtual void layerRemoved(RS_Layer *) {} - - /** - * Called when a layer's attributes are modified. - */ - virtual void layerEdited(RS_Layer *) {} - - /** - * Called when a layer's visibility is toggled. - */ - virtual void layerToggled(RS_Layer *) {} -}; - -#endif diff --git a/src/base/rs_modification.h b/src/base/rs_modification.h index 41fb026..c4183f9 100644 --- a/src/base/rs_modification.h +++ b/src/base/rs_modification.h @@ -212,7 +212,6 @@ class RS_Modification bool explode(); bool explodeTextIntoLetters(); -// bool explodeTextIntoLetters(RS_Text* text, Q3PtrList& addList); bool explodeTextIntoLetters(RS_Text * text, QList & addList); bool moveRef(RS_MoveRefData & data); @@ -228,7 +227,6 @@ class RS_Modification private: void deselectOriginals(bool remove); -// void addNewEntities(Q3PtrList& addList); void addNewEntities(QList & addList); protected: diff --git a/src/base/rs_solid.cpp b/src/base/rs_solid.cpp index da06c26..8e3814e 100644 --- a/src/base/rs_solid.cpp +++ b/src/base/rs_solid.cpp @@ -16,6 +16,7 @@ #include "rs_solid.h" +#include "rs_debug.h" #include "graphicview.h" #include "paintinterface.h" diff --git a/src/base/rs_undoable.h b/src/base/rs_undoable.h index 1bd2ae0..87e4403 100644 --- a/src/base/rs_undoable.h +++ b/src/base/rs_undoable.h @@ -1,6 +1,7 @@ #ifndef RS_UNDOABLE_H #define RS_UNDOABLE_H +#include "rs.h" #include "rs_flags.h" class RS_UndoCycle; diff --git a/src/mainapp/applicationwindow.cpp b/src/mainapp/applicationwindow.cpp index fbafedc..42c90cc 100644 --- a/src/mainapp/applicationwindow.cpp +++ b/src/mainapp/applicationwindow.cpp @@ -1903,6 +1903,7 @@ MDIWindow * ApplicationWindow::slotFileNew(RS_Document * doc) RS_DEBUG->print(" adding listeners"); Drawing * graphic = w->getDocument()->getGraphic(); +#if 0 if (graphic != NULL) { // Link the graphic's layer list to the pen tool bar @@ -1912,6 +1913,7 @@ MDIWindow * ApplicationWindow::slotFileNew(RS_Document * doc) // Link the block list to the block widget graphic->addBlockListListener(blockWidget); } +#endif // Link the dialog factory to the mouse widget: QG_DIALOGFACTORY->setMouseWidget(mouseWidget); @@ -2603,14 +2605,16 @@ void ApplicationWindow::slotFilePrintPreview(bool on) RS_DEBUG->print(" adding listeners"); Drawing * graphic = w->getDocument()->getGraphic(); - if (graphic != NULL) + if (graphic) { +#if 0 // Link the layer list to the pen tool bar graphic->addLayerListListener(penToolBar); // Link the layer list to the layer widget graphic->addLayerListListener(layerWidget); // Link the block list to the block widget graphic->addBlockListListener(blockWidget); +#endif // Center by default: graphic->centerToPage(); } diff --git a/src/widgets/qg_blockwidget.cpp b/src/widgets/qg_blockwidget.cpp index 1c94e22..4be0f71 100644 --- a/src/widgets/qg_blockwidget.cpp +++ b/src/widgets/qg_blockwidget.cpp @@ -16,6 +16,11 @@ #include "qg_blockwidget.h" +#include "qg_actionhandler.h" +#include "rs_block.h" +#include "rs_blocklist.h" +#include "rs_debug.h" + /** * Constructor. */ @@ -173,12 +178,12 @@ void QG_BlockWidget::update() RS_Block * activeBlock = NULL; - if (blockList != NULL) + if (blockList) activeBlock = blockList->getActive(); listBox->clear(); - if (blockList == NULL) + if (!blockList) { RS_DEBUG->print("QG_BlockWidget::update(): blockList is NULL"); return; @@ -218,7 +223,7 @@ void QG_BlockWidget::highlightBlock(RS_Block * block) { RS_DEBUG->print("QG_BlockWidget::highlightBlock()"); - if (block == NULL || listBox == NULL) + if (!block || !listBox) return; blockList->activate(block); @@ -228,10 +233,8 @@ void QG_BlockWidget::highlightBlock(RS_Block * block) { QListWidgetItem * item = listBox->item(i); -// if (listBox->text(i) == name) if (item->text() == name) { -// listBox->setCurrentItem(i); listBox->setCurrentRow(i); break; } @@ -294,7 +297,7 @@ void QG_BlockWidget::slotActivated(void) QString blockName = listBox->currentItem()->text(); RS_DEBUG->print("QG_BlockWidget::slotActivated(): %s", blockName.toLatin1().data()); - if (blockList == NULL) + if (!blockList) return; lastBlock = blockList->getActive(); @@ -317,7 +320,7 @@ void QG_BlockWidget::slotMouseButtonClicked(QListWidgetItem * item) } else { - if (item != NULL && blockList != NULL) + if (item && blockList) lastBlock = blockList->find(item->text()); } } diff --git a/src/widgets/qg_blockwidget.h b/src/widgets/qg_blockwidget.h index efb8e04..701f583 100644 --- a/src/widgets/qg_blockwidget.h +++ b/src/widgets/qg_blockwidget.h @@ -2,15 +2,19 @@ #define QG_BLOCKWIDGET_H #include -#include "rs_blocklist.h" -#include "rs_blocklistlistener.h" -#include "qg_actionhandler.h" +//#include "rs_blocklist.h" +//#include "rs_blocklistlistener.h" +//#include "qg_actionhandler.h" + +class RS_Block; +class RS_BlockList; +class QG_ActionHandler; /** * This is the Qt implementation of a widget which can view a * block list. */ -class QG_BlockWidget: public QWidget, public RS_BlockListListener +class QG_BlockWidget: public QWidget//, public RS_BlockListListener { Q_OBJECT diff --git a/src/widgets/qg_dialogfactory.cpp b/src/widgets/qg_dialogfactory.cpp index aee82b4..c7b3f0a 100644 --- a/src/widgets/qg_dialogfactory.cpp +++ b/src/widgets/qg_dialogfactory.cpp @@ -24,6 +24,7 @@ #include "rs_blocklist.h" #include "rs_document.h" #include "rs_hatch.h" +#include "rs_layerlist.h" #include "rs_patternlist.h" #include "settings.h" #include "rs_system.h" diff --git a/src/widgets/qg_graphicview.h b/src/widgets/qg_graphicview.h index b870809..9d4cf8c 100644 --- a/src/widgets/qg_graphicview.h +++ b/src/widgets/qg_graphicview.h @@ -3,8 +3,8 @@ #include #include "graphicview.h" -#include "rs_layerlistlistener.h" -#include "rs_blocklistlistener.h" +//#include "rs_layerlistlistener.h" +//#include "rs_blocklistlistener.h" class RS_Document; class PaintInterface; diff --git a/src/widgets/qg_layerwidget.cpp b/src/widgets/qg_layerwidget.cpp index 9f34842..bb422c0 100644 --- a/src/widgets/qg_layerwidget.cpp +++ b/src/widgets/qg_layerwidget.cpp @@ -16,15 +16,10 @@ #include "qg_layerwidget.h" -/*#include "xpm/layerstatus_00.xpm" -#include "xpm/layerstatus_01.xpm" -#include "xpm/layerstatus_10.xpm" -#include "xpm/layerstatus_11.xpm" -#include "xpm/visibleblock.xpm" -#include "xpm/hiddenblock.xpm" -#include "xpm/layeradd.xpm" -#include "xpm/layerremove.xpm" -#include "xpm/layeredit.xpm"*/ +#include "qg_actionhandler.h" +#include "rs_debug.h" +#include "rs_layer.h" +#include "rs_layerlist.h" /** * Constructor. @@ -32,17 +27,6 @@ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler * ah, QWidget * parent, const char * name, Qt::WindowFlags f): QWidget(parent, f), -/* pxmLayerStatus00(layerstatus_00_xpm), - pxmLayerStatus01(layerstatus_01_xpm), - pxmLayerStatus10(layerstatus_10_xpm), - pxmLayerStatus11(layerstatus_11_xpm), - pxmVisible(visibleblock_xpm), - pxmHidden(hiddenblock_xpm), - pxmAdd(layeradd_xpm), - pxmRemove(layerremove_xpm), - pxmEdit(layeredit_xpm), - pxmDefreezeAll(visibleblock_xpm), - pxmFreezeAll(hiddenblock_xpm)*/ pxmLayerStatus00(":/res/layerstatus_00.xpm"), pxmLayerStatus01(":/res/layerstatus_01.xpm"), pxmLayerStatus10(":/res/layerstatus_10.xpm"), diff --git a/src/widgets/qg_layerwidget.h b/src/widgets/qg_layerwidget.h index 3f4a5af..bddf87e 100644 --- a/src/widgets/qg_layerwidget.h +++ b/src/widgets/qg_layerwidget.h @@ -2,15 +2,19 @@ #define QG_LAYERWIDGET_H #include -#include "rs_layerlist.h" -#include "rs_layerlistlistener.h" -#include "qg_actionhandler.h" +//#include "rs_layerlist.h" +//#include "rs_layerlistlistener.h" +//#include "qg_actionhandler.h" + +class QG_ActionHandler; +class RS_Layer; +class RS_LayerList; /** * This is the Qt implementation of a widget which can view a * layer list and provides a user interface for basic layer actions. */ -class QG_LayerWidget: public QWidget, public RS_LayerListListener +class QG_LayerWidget: public QWidget//, public RS_LayerListListener { Q_OBJECT @@ -34,7 +38,6 @@ class QG_LayerWidget: public QWidget, public RS_LayerListListener void escape(); public slots: -// void slotActivated(const QString & layerName); void slotActivated(void); // void slotMouseButtonClicked(int button, Q3ListBoxItem * item, const QPoint & pos); void slotMouseButtonClicked(QListWidgetItem *); diff --git a/src/widgets/qg_pentoolbar.cpp b/src/widgets/qg_pentoolbar.cpp index 36b9299..426d915 100644 --- a/src/widgets/qg_pentoolbar.cpp +++ b/src/widgets/qg_pentoolbar.cpp @@ -21,6 +21,7 @@ #include "qg_colorbox.h" #include "qg_widthbox.h" #include "qg_linetypebox.h" +#include "rs_layer.h" /** * Constructor. diff --git a/src/widgets/qg_pentoolbar.h b/src/widgets/qg_pentoolbar.h index ffb3c78..2b976e8 100644 --- a/src/widgets/qg_pentoolbar.h +++ b/src/widgets/qg_pentoolbar.h @@ -2,17 +2,18 @@ #define QG_PENTOOLBAR_H #include -#include "rs_layerlistlistener.h" +//#include "rs_layerlistlistener.h" #include "rs_pen.h" class QG_ColorBox; class QG_WidthBox; class QG_LineTypeBox; +class RS_Layer; /** * A toolbar that offers all widgets for choosing a pen. */ -class QG_PenToolBar: public QToolBar, public RS_LayerListListener +class QG_PenToolBar: public QToolBar//, public RS_LayerListListener { Q_OBJECT