what the class is and not a bitmap (which is what is implied).
src/base/rs_font.h \
src/base/rs_fontchar.h \
src/base/rs_fontlist.h \
- src/base/rs_graphic.h \
+ src/base/drawing.h \
src/base/rs_hatch.h \
src/base/rs_insert.h \
src/base/rs_image.h \
src/base/rs_entitycontainer.cpp \
src/base/rs_font.cpp \
src/base/rs_fontlist.cpp \
- src/base/rs_graphic.cpp \
+ src/base/drawing.cpp \
src/base/rs_hatch.cpp \
src/base/rs_insert.cpp \
src/base/rs_image.cpp \
src/base/rs_filterdxf.cpp \
src/base/rs_filterdxf1.cpp \
src/base/rs_filterinterface.cpp \
+ src/base/rs_commandevent.cpp \
src/base/rs_dialogfactory.cpp \
src/base/rs_eventhandler.cpp \
src/base/rs_graphicview.cpp \
#include "rs_actionblocksadd.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_dialogfactory.h"
RS_ActionBlocksAdd::RS_ActionBlocksAdd(RS_EntityContainer& container,
#include "rs_actionblocksattributes.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_dialogfactory.h"
#include "rs_actionblocksedit.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_dialogfactory.h"
#include "rs_actionblocksfreezeall.h"
-#include "rs_graphic.h"
+#include "drawing.h"
RS_ActionBlocksFreezeAll::RS_ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container,
RS_GraphicView& graphicView): RS_ActionInterface("Freeze all Blocks",
#include "rs_actionblocksremove.h"
#include "rs_block.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_insert.h"
#include "rs_dialogfactory.h"
#include "rs_actionblockstoggleview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_actionfilenew.h"
-#include "rs_graphic.h"
+#include "drawing.h"
RS_ActionFileNew::RS_ActionFileNew(RS_EntityContainer & container,
RS_GraphicView & graphicView):
#include "rs_actionfileopen.h"
-#include "rs_graphic.h"
+#include "drawing.h"
RS_ActionFileOpen::RS_ActionFileOpen(RS_EntityContainer & container,
RS_GraphicView & graphicView):
#include "rs_actionfilesave.h"
-#include "rs_graphic.h"
+#include "drawing.h"
//Added by qt3to4:
//#include <QPixmap>
#include "rs_actionfilesaveas.h"
-#include "rs_graphic.h"
+#include "drawing.h"
//Added by qt3to4:
//#include <QPixmap>
#include "rs_actionlayersadd.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_actionlayersedit.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_actionlayersfreezeall.h"
-#include "rs_graphic.h"
+#include "drawing.h"
RS_ActionLayersFreezeAll::RS_ActionLayersFreezeAll(bool freeze,
RS_EntityContainer& container,
#include "rs_actionlayersremove.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_actionlayerstogglelock.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_actionlayerstoggleview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
protected:
//RS_Block* block;
//RS_InsertData data;
- RS_Graphic prev;
+ Drawing prev;
RS_LibraryInsertData data;
/** Last status before entering option. */
-// rs_graphic.cpp
+// drawing.cpp
//
// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/21/2010 Added this text. :-)
+// JLH 06/02/2010 Changed all references of this class from RS_Graphic to
+// Drawing, as that makes it more clear that this is what it
+// is (a CAD drawing, not a bitmap).
//
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_debug.h"
#include "rs_fileio.h"
/**
* Default constructor.
*/
-RS_Graphic::RS_Graphic(RS_EntityContainer * parent): RS_Document(parent), layerList(),
+Drawing::Drawing(RS_EntityContainer * parent): RS_Document(parent), layerList(),
blockList(true)
#ifdef RS_CAM
, camData()
/**
* Destructor.
*/
-RS_Graphic::~RS_Graphic()
+Drawing::~Drawing()
{
}
/** @return RS2::EntityGraphic */
-/*virtual*/ RS2::EntityType RS_Graphic::rtti() const
+/*virtual*/ RS2::EntityType Drawing::rtti() const
{
return RS2::EntityGraphic;
}
/**
* Counts the entities on the given layer.
*/
-unsigned long int RS_Graphic::countLayerEntities(RS_Layer * layer)
+unsigned long int Drawing::countLayerEntities(RS_Layer * layer)
{
int c = 0;
return c;
}
-/*virtual*/ RS_LayerList * RS_Graphic::getLayerList()
+/*virtual*/ RS_LayerList * Drawing::getLayerList()
{
return &layerList;
}
-/*virtual*/ RS_BlockList * RS_Graphic::getBlockList()
+/*virtual*/ RS_BlockList * Drawing::getBlockList()
{
return &blockList;
}
* Clears all layers, blocks and entities of this graphic.
* A default layer (0) is created.
*/
-void RS_Graphic::newDoc()
+void Drawing::newDoc()
{
- RS_DEBUG->print("RS_Graphic::newDoc");
+ RS_DEBUG->print("Drawing::newDoc");
clear();
/**
* Saves this graphic with the current filename and settings.
*/
-bool RS_Graphic::save()
+bool Drawing::save()
{
bool ret = false;
- RS_DEBUG->print("RS_Graphic::save");
+ RS_DEBUG->print("Drawing::save");
RS_DEBUG->print(" file: %s", filename.toLatin1().data());
RS_DEBUG->print(" format: %d", (int)formatType);
blockList.setModified(false);
}
- RS_DEBUG->print("RS_Graphic::save ok");
+ RS_DEBUG->print("Drawing::save ok");
return ret;
}
/**
* Saves this graphic with the given filename and current settings.
*/
-bool RS_Graphic::saveAs(const QString & filename, RS2::FormatType type)
+bool Drawing::saveAs(const QString & filename, RS2::FormatType type)
{
- RS_DEBUG->print("RS_Graphic::saveAs");
+ RS_DEBUG->print("Drawing::saveAs");
this->filename = filename;
this->formatType = type;
/**
* Loads the given fils into this graphic.
*/
-bool RS_Graphic::open(const QString &filename, RS2::FormatType type)
+bool Drawing::open(const QString &filename, RS2::FormatType type)
{
- RS_DEBUG->print("RS_Graphic::open(%s)", filename.toLatin1().data());
+ RS_DEBUG->print("Drawing::open(%s)", filename.toLatin1().data());
bool ret = false;
layerList.setModified(false);
blockList.setModified(false);
- //cout << *((RS_Graphic*)graphic);
+ //cout << *((Drawing*)graphic);
//calculateBorders();
- RS_DEBUG->print("RS_Graphic::open(%s): OK", filename.toLatin1().data());
+ RS_DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data());
return ret;
}
// Wrappers for Layer functions:
-void RS_Graphic::clearLayers()
+void Drawing::clearLayers()
{
layerList.clear();
}
-uint RS_Graphic::countLayers() const
+uint Drawing::countLayers() const
{
return layerList.count();
}
-RS_Layer * RS_Graphic::layerAt(uint i)
+RS_Layer * Drawing::layerAt(uint i)
{
return layerList.at(i);
}
-void RS_Graphic::activateLayer(const QString & name)
+void Drawing::activateLayer(const QString & name)
{
layerList.activate(name);
}
-void RS_Graphic::activateLayer(RS_Layer * layer)
+void Drawing::activateLayer(RS_Layer * layer)
{
layerList.activate(layer);
}
-RS_Layer * RS_Graphic::getActiveLayer()
+RS_Layer * Drawing::getActiveLayer()
{
return layerList.getActive();
}
-/*virtual*/ void RS_Graphic::addLayer(RS_Layer * layer)
+/*virtual*/ void Drawing::addLayer(RS_Layer * layer)
{
layerList.add(layer);
}
/**
* Removes the given layer and undoes all entities on it.
*/
-/*virtual*/ void RS_Graphic::removeLayer(RS_Layer * layer)
+/*virtual*/ void Drawing::removeLayer(RS_Layer * layer)
{
if (layer != NULL && layer->getName() != "0")
{
}
}
-/*virtual*/ void RS_Graphic::editLayer(RS_Layer * layer, const RS_Layer & source)
+/*virtual*/ void Drawing::editLayer(RS_Layer * layer, const RS_Layer & source)
{
layerList.edit(layer, source);
}
-RS_Layer * RS_Graphic::findLayer(const QString & name)
+RS_Layer * Drawing::findLayer(const QString & name)
{
return layerList.find(name);
}
-void RS_Graphic::toggleLayer(const QString & name)
+void Drawing::toggleLayer(const QString & name)
{
layerList.toggle(name);
}
-void RS_Graphic::toggleLayer(RS_Layer * layer)
+void Drawing::toggleLayer(RS_Layer * layer)
{
layerList.toggle(layer);
}
-void RS_Graphic::toggleLayerLock(RS_Layer * layer)
+void Drawing::toggleLayerLock(RS_Layer * layer)
{
layerList.toggleLock(layer);
}
-void RS_Graphic::freezeAllLayers(bool freeze)
+void Drawing::freezeAllLayers(bool freeze)
{
layerList.freezeAll(freeze);
}
-void RS_Graphic::addLayerListListener(RS_LayerListListener * listener)
+void Drawing::addLayerListListener(RS_LayerListListener * listener)
{
layerList.addListener(listener);
}
-void RS_Graphic::removeLayerListListener(RS_LayerListListener * listener)
+void Drawing::removeLayerListListener(RS_LayerListListener * listener)
{
layerList.removeListener(listener);
}
// Wrapper for block functions:
-void RS_Graphic::clearBlocks()
+void Drawing::clearBlocks()
{
blockList.clear();
}
-uint RS_Graphic::countBlocks()
+uint Drawing::countBlocks()
{
return blockList.count();
}
-RS_Block * RS_Graphic::blockAt(uint i)
+RS_Block * Drawing::blockAt(uint i)
{
return blockList.at(i);
}
-void RS_Graphic::activateBlock(const QString & name)
+void Drawing::activateBlock(const QString & name)
{
blockList.activate(name);
}
-void RS_Graphic::activateBlock(RS_Block * block)
+void Drawing::activateBlock(RS_Block * block)
{
blockList.activate(block);
}
-RS_Block * RS_Graphic::getActiveBlock()
+RS_Block * Drawing::getActiveBlock()
{
return blockList.getActive();
}
-/*virtual*/ bool RS_Graphic::addBlock(RS_Block * block, bool notify/*= true*/)
+/*virtual*/ bool Drawing::addBlock(RS_Block * block, bool notify/*= true*/)
{
return blockList.add(block, notify);
}
-/*virtual*/ void RS_Graphic::addBlockNotification()
+/*virtual*/ void Drawing::addBlockNotification()
{
blockList.addNotification();
}
-/*virtual*/ void RS_Graphic::removeBlock(RS_Block * block)
+/*virtual*/ void Drawing::removeBlock(RS_Block * block)
{
blockList.remove(block);
}
-RS_Block * RS_Graphic::findBlock(const QString & name)
+RS_Block * Drawing::findBlock(const QString & name)
{
return blockList.find(name);
}
-QString RS_Graphic::newBlockName()
+QString Drawing::newBlockName()
{
return blockList.newName();
}
-void RS_Graphic::toggleBlock(const QString & name)
+void Drawing::toggleBlock(const QString & name)
{
blockList.toggle(name);
}
-void RS_Graphic::toggleBlock(RS_Block * block)
+void Drawing::toggleBlock(RS_Block * block)
{
blockList.toggle(block);
}
-void RS_Graphic::freezeAllBlocks(bool freeze)
+void Drawing::freezeAllBlocks(bool freeze)
{
blockList.freezeAll(freeze);
}
-void RS_Graphic::addBlockListListener(RS_BlockListListener * listener)
+void Drawing::addBlockListListener(RS_BlockListListener * listener)
{
blockList.addListener(listener);
}
-void RS_Graphic::removeBlockListListener(RS_BlockListListener * listener)
+void Drawing::removeBlockListListener(RS_BlockListListener * listener)
{
blockList.removeListener(listener);
}
// Wrappers for variable functions:
-void RS_Graphic::clearVariables()
+void Drawing::clearVariables()
{
variableDict.clear();
}
-int RS_Graphic::countVariables()
+int Drawing::countVariables()
{
return variableDict.count();
}
-void RS_Graphic::addVariable(const QString & key, const Vector & value, int code)
+void Drawing::addVariable(const QString & key, const Vector & value, int code)
{
variableDict.add(key, value, code);
}
-void RS_Graphic::addVariable(const QString & key, const QString & value, int code)
+void Drawing::addVariable(const QString & key, const QString & value, int code)
{
variableDict.add(key, value, code);
}
-void RS_Graphic::addVariable(const QString & key, int value, int code)
+void Drawing::addVariable(const QString & key, int value, int code)
{
variableDict.add(key, value, code);
}
-void RS_Graphic::addVariable(const QString & key, double value, int code)
+void Drawing::addVariable(const QString & key, double value, int code)
{
variableDict.add(key, value, code);
}
-Vector RS_Graphic::getVariableVector(const QString & key, const Vector & def)
+Vector Drawing::getVariableVector(const QString & key, const Vector & def)
{
return variableDict.getVector(key, def);
}
-QString RS_Graphic::getVariableString(const QString & key, const QString & def)
+QString Drawing::getVariableString(const QString & key, const QString & def)
{
return variableDict.getString(key, def);
}
-int RS_Graphic::getVariableInt(const QString & key, int def)
+int Drawing::getVariableInt(const QString & key, int def)
{
return variableDict.getInt(key, def);
}
-double RS_Graphic::getVariableDouble(const QString & key, double def)
+double Drawing::getVariableDouble(const QString & key, double def)
{
return variableDict.getDouble(key, def);
}
-void RS_Graphic::removeVariable(const QString & key)
+void Drawing::removeVariable(const QString & key)
{
variableDict.remove(key);
}
//Q3Dict<RS_Variable> & getVariableDict()
-QMultiHash<QString, RS_Variable *> & RS_Graphic::getVariableDict()
+QMultiHash<QString, RS_Variable *> & Drawing::getVariableDict()
{
return variableDict.getVariableDict();
}
/**
* @return true if the grid is switched on (visible).
*/
-bool RS_Graphic::isGridOn()
+bool Drawing::isGridOn()
{
int on = getVariableInt("$GRIDMODE", 1);
return (on != 0);
/**
* Enables / disables the grid.
*/
-void RS_Graphic::setGridOn(bool on)
+void Drawing::setGridOn(bool on)
{
addVariable("$GRIDMODE", (int)on, 70);
}
/**
* Sets the unit of this graphic to 'u'
*/
-void RS_Graphic::setUnit(RS2::Unit u)
+void Drawing::setUnit(RS2::Unit u)
{
setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u));
/**
* Gets the unit of this graphic
*/
-RS2::Unit RS_Graphic::getUnit()
+RS2::Unit Drawing::getUnit()
{
return (RS2::Unit)getVariableInt("$INSUNITS", 0);
//return unit;
* @return The linear format type for this document.
* This is determined by the variable "$LUNITS".
*/
-RS2::LinearFormat RS_Graphic::getLinearFormat()
+RS2::LinearFormat Drawing::getLinearFormat()
{
int lunits = getVariableInt("$LUNITS", 2);
* @return The linear precision for this document.
* This is determined by the variable "$LUPREC".
*/
-int RS_Graphic::getLinearPrecision()
+int Drawing::getLinearPrecision()
{
return getVariableInt("$LUPREC", 4);
}
* @return The angle format type for this document.
* This is determined by the variable "$AUNITS".
*/
-RS2::AngleFormat RS_Graphic::getAngleFormat()
+RS2::AngleFormat Drawing::getAngleFormat()
{
int aunits = getVariableInt("$AUNITS", 0);
* @return The linear precision for this document.
* This is determined by the variable "$LUPREC".
*/
-int RS_Graphic::getAnglePrecision()
+int Drawing::getAnglePrecision()
{
return getVariableInt("$AUPREC", 4);
}
* This is the distance from the lower left paper edge to the zero
* point of the drawing. DXF: $PINSBASE.
*/
-Vector RS_Graphic::getPaperInsertionBase()
+Vector Drawing::getPaperInsertionBase()
{
return getVariableVector("$PINSBASE", Vector(0.0,0.0));
}
/**
* Sets the PINSBASE variable.
*/
-void RS_Graphic::setPaperInsertionBase(const Vector & p)
+void Drawing::setPaperInsertionBase(const Vector & p)
{
addVariable("$PINSBASE", p, 10);
}
/**
* @return Paper size in graphic units.
*/
-Vector RS_Graphic::getPaperSize()
+Vector Drawing::getPaperSize()
{
Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit());
/**
* Sets a new paper size.
*/
-void RS_Graphic::setPaperSize(const Vector & s)
+void Drawing::setPaperSize(const Vector & s)
{
addVariable("$PLIMMIN", Vector(0.0, 0.0), 10);
addVariable("$PLIMMAX", s, 10);
*
* @param landscape will be set to true for landscape and false for portrait if not NULL.
*/
-RS2::PaperFormat RS_Graphic::getPaperFormat(bool * landscape)
+RS2::PaperFormat Drawing::getPaperFormat(bool * landscape)
{
Vector size = RS_Units::convert(getPaperSize(), getUnit(), RS2::Millimeter);
/**
* Sets the paper format to the given format.
*/
-void RS_Graphic::setPaperFormat(RS2::PaperFormat f, bool landscape)
+void Drawing::setPaperFormat(RS2::PaperFormat f, bool landscape)
{
Vector size = RS_Units::paperFormatToSize(f);
/**
* @return Paper space scaling (DXF: $PSVPSCALE).
*/
-double RS_Graphic::getPaperScale()
+double Drawing::getPaperScale()
{
double ret;
/**
* Sets a new scale factor for the paper space.
*/
-void RS_Graphic::setPaperScale(double s)
+void Drawing::setPaperScale(double s)
{
addVariable("$PSVPSCALE", s, 40);
}
/**
* Centers drawing on page. Affects DXF variable $PINSBASE.
*/
-void RS_Graphic::centerToPage()
+void Drawing::centerToPage()
{
Vector size = getPaperSize();
double scale = getPaperScale();
/**
* Fits drawing on page. Affects DXF variable $PINSBASE.
*/
-void RS_Graphic::fitToPage()
+void Drawing::fitToPage()
{
double border = RS_Units::convert(25.0, RS2::Millimeter, getUnit());
Vector ps = getPaperSize() - Vector(border, border);
* @retval true The document has been modified since it was last saved.
* @retval false The document has not been modified since it was last saved.
*/
-/*virtual*/ bool RS_Graphic::isModified() const
+/*virtual*/ bool Drawing::isModified() const
{
return modified || layerList.isModified() || blockList.isModified();
}
/**
* Sets the documents modified status to 'm'.
*/
-/*virtual*/ void RS_Graphic::setModified(bool m)
+/*virtual*/ void Drawing::setModified(bool m)
{
modified = m;
layerList.setModified(m);
}
#ifdef RS_CAM
-RS_CamData & RS_Graphic::getCamData()
+RS_CamData & Drawing::getCamData()
{
return camData;
}
-void RS_Graphic::setCamData(const RS_CamData & d)
+void Drawing::setCamData(const RS_CamData & d)
{
camData = d;
}
/**
* Dumps the entities to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_Graphic & g)
+std::ostream & operator<<(std::ostream & os, Drawing & g)
{
- os << "--- Graphic: \n";
+ os << "--- Drawing: \n";
os << "---" << *g.getLayerList() << "\n";
os << "---" << *g.getBlockList() << "\n";
os << "---" << (RS_Undo&)g << "\n";
*
* @author Andrew Mustun
*/
-class RS_Graphic: public RS_Document
+class Drawing: public RS_Document
{
public:
- RS_Graphic(RS_EntityContainer * parent = NULL);
- virtual ~RS_Graphic();
+ Drawing(RS_EntityContainer * parent = NULL);
+ virtual ~Drawing();
virtual RS2::EntityType rtti() const;
virtual unsigned long int countLayerEntities(RS_Layer * layer);
void setCamData(const RS_CamData & d);
#endif
- friend std::ostream & operator<<(std::ostream & os, RS_Graphic & g);
+ friend std::ostream & operator<<(std::ostream & os, Drawing & g);
private:
RS_LayerList layerList;
#include "rs_entitycontainer.h"
#include "rs_commandevent.h"
//#include "rs_event.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_graphicview.h"
#include "rs_snapper.h"
#include "rs_preview.h"
* Pointer to the graphic is this container is a graphic.
* NULL otherwise
*/
- RS_Graphic * graphic;
+ Drawing * graphic;
/**
* Pointer to the document (graphic or block) or NULL.
#include "rs_block.h"
#include <iomanip>
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* @param parent The graphic this block belongs to.
RS_LayerList * RS_Block::getLayerList()
{
- RS_Graphic * g = getGraphic();
+ Drawing * g = getGraphic();
if (g != NULL)
return g->getLayerList();
RS_BlockList * RS_Block::getBlockList()
{
- RS_Graphic * g = getGraphic();
+ Drawing * g = getGraphic();
if (g != NULL)
return g->getBlockList();
bool RS_Block::save()
{
- RS_Graphic * g = getGraphic();
+ Drawing * g = getGraphic();
if (g != NULL)
return g->save();
bool RS_Block::saveAs(const QString & filename, RS2::FormatType type)
{
- RS_Graphic * g = getGraphic();
+ Drawing * g = getGraphic();
if (g != NULL)
return g->saveAs(filename, type);
*/
void RS_Block::setModified(bool m)
{
- RS_Graphic * p = getGraphic();
+ Drawing * p = getGraphic();
if (p)
p->setModified(m);
#define RS_CLIPBOARD_H
#include <iostream>
-#include "rs_graphic.h"
+#include "drawing.h"
#define RS_CLIPBOARD RS_Clipboard::instance()
return graphic.nextEntity();
}
- RS_Graphic* getGraphic() {
+ Drawing* getGraphic() {
return &graphic;
}
protected:
static RS_Clipboard* uniqueInstance;
- RS_Graphic graphic;
+ Drawing graphic;
};
#endif
class RS_CommandEvent
{
public:
- /**
- * Creates a new command event that is not yet accepted.
- *
- * @param cmd the command that was triggered.
- */
- RS_CommandEvent(const QString & cmd)
- {
- this->cmd = cmd;
- accepted = false;
- }
+ RS_CommandEvent(const QString & cmd);
- /**
- * @return the command that was triggered, usually by
- * the user.
- */
- QString getCommand()
- {
- return cmd;
- }
-
- /**
- * Sets the event state to accepted.
- */
- void accept()
- {
- accepted = true;
- }
-
- /**
- * @return Whether the event was already accepted or not.
- */
- bool isAccepted()
- {
- return accepted;
- }
+ QString getCommand();
+ void accept();
+ bool isAccepted();
protected:
QString cmd;
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/28/2010 Added this text. :-)
+// JLH 06/02/2010 Moved implementation from header to here WHERE IT BELONGS.
//
#include "rs_constructionline.h"
return c;
}
+/** @return RS2::EntityConstructionLine */
+/*virtual*/ RS2::EntityType RS_ConstructionLine::rtti() const
+{
+ return RS2::EntityConstructionLine;
+}
+
+/**
+ * @todo
+ * @return Start point of the entity.
+ */
+/*virtual*/ Vector RS_ConstructionLine::getStartpoint() const
+{
+ return Vector(false);
+}
+
+/**
+ * @todo
+ * @return End point of the entity.
+ */
+/*virtual*/ Vector RS_ConstructionLine::getEndpoint() const
+{
+ return Vector(false);
+}
+
+/** @return Copy of data that defines the line. */
+RS_ConstructionLineData RS_ConstructionLine::getData() const
+{
+ return data;
+}
+
+/** @return First definition point. */
+Vector RS_ConstructionLine::getPoint1() const
+{
+ return data.point1;
+}
+/** @return Second definition point. */
+Vector RS_ConstructionLine::getPoint2() const
+{
+ return data.point2;
+}
+
void RS_ConstructionLine::calculateBorders()
{
minV = Vector::minimum(data.point1, data.point2);
*/
class RS_ConstructionLineData
{
-public:
- /**
- * Default constructor. Leaves the data object uninitialized.
- */
- RS_ConstructionLineData() {}
-
- RS_ConstructionLineData(const Vector& point1,
- const Vector& point2) {
-
- this->point1 = point1;
- this->point2 = point2;
- }
-
- friend class RS_ConstructionLine;
-
- friend std::ostream& operator << (std::ostream& os,
- const RS_ConstructionLineData& ld) {
-
- os << "(" << ld.point1 <<
- "/" << ld.point2 <<
- ")";
- return os;
- }
-
-private:
- Vector point1;
- Vector point2;
+ public:
+ /**
+ * Default constructor. Leaves the data object uninitialized.
+ */
+ RS_ConstructionLineData() {}
+
+ RS_ConstructionLineData(const Vector & point1, const Vector & point2)
+ {
+ this->point1 = point1;
+ this->point2 = point2;
+ }
+
+ friend class RS_ConstructionLine;
+
+ friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLineData & ld)
+ {
+ os << "(" << ld.point1 <<
+ "/" << ld.point2 <<
+ ")";
+ return os;
+ }
+
+ private:
+ Vector point1;
+ Vector point2;
};
-
/**
* Class for a construction line entity.
*
* @author Andrew Mustun
*/
-class RS_ConstructionLine : public RS_AtomicEntity {
-public:
- RS_ConstructionLine(RS_EntityContainer* parent,
- const RS_ConstructionLineData& d);
-
- virtual RS_Entity* clone();
-
- virtual ~RS_ConstructionLine();
-
- /** @return RS2::EntityConstructionLine */
- virtual RS2::EntityType rtti() const {
- return RS2::EntityConstructionLine;
- }
-
- /**
- * @todo
- * @return Start point of the entity.
- */
- virtual Vector getStartpoint() const {
- return Vector(false);
- }
- /**
- * @todo
- * @return End point of the entity.
- */
- virtual Vector getEndpoint() const {
- return Vector(false);
- }
-
- /** @return Copy of data that defines the line. */
- RS_ConstructionLineData getData() const {
- return data;
- }
-
- /** @return First definition point. */
- Vector getPoint1() const {
- return data.point1;
- }
- /** @return Second definition point. */
- Vector getPoint2() const {
- return data.point2;
- }
-
- virtual Vector getNearestEndpoint(const Vector& coord,
- double* dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector& coord,
- bool onEntity = true, double* dist = NULL, RS_Entity** entity=NULL);
- virtual Vector getNearestCenter(const Vector& coord,
- double* dist = NULL);
- virtual Vector getNearestMiddle(const Vector& coord,
- double* dist = NULL);
- virtual Vector getNearestDist(double distance,
- const Vector& coord,
- double* dist = NULL);
- virtual double getDistanceToPoint(const Vector& coord,
- RS_Entity** entity=NULL,
- RS2::ResolveLevel level=RS2::ResolveNone,
- double solidDist = RS_MAXDOUBLE);
-
- virtual void move(Vector offset);
- virtual void rotate(Vector center, double angle);
- virtual void scale(Vector center, Vector factor);
- virtual void mirror(Vector axisPoint1, Vector axisPoint2);
-
-// virtual void draw(RS_Painter* /*painter*/, RS_GraphicView* /*view*/,
- virtual void draw(PaintInterface * /*painter*/, RS_GraphicView* /*view*/,
- double /*patternOffset*/) {}
-
- friend std::ostream& operator << (std::ostream& os,
- const RS_ConstructionLine& l);
-
- virtual void calculateBorders();
-
-protected:
- RS_ConstructionLineData data;
+class RS_ConstructionLine: public RS_AtomicEntity
+{
+ public:
+ RS_ConstructionLine(RS_EntityContainer * parent, const RS_ConstructionLineData & d);
+ virtual ~RS_ConstructionLine();
+
+ virtual RS_Entity * clone();
+ virtual RS2::EntityType rtti() const;
+ virtual Vector getStartpoint() const;
+ virtual Vector getEndpoint() const;
+ RS_ConstructionLineData getData() const;
+ Vector getPoint1() const;
+ Vector getPoint2() const;
+ virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
+ virtual Vector getNearestPointOnEntity(const Vector & coord,
+ bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
+ virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
+ virtual Vector getNearestDist(double distance, const Vector & coord,
+ double * dist = NULL);
+ virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
+ RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
+ virtual void move(Vector offset);
+ virtual void rotate(Vector center, double angle);
+ virtual void scale(Vector center, Vector factor);
+ virtual void mirror(Vector axisPoint1, Vector axisPoint2);
+ virtual void draw(PaintInterface * /*painter*/, RS_GraphicView * /*view*/,
+ double /*patternOffset*/) {}
+
+ friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l);
+ virtual void calculateBorders();
+
+ protected:
+ RS_ConstructionLineData data;
};
#endif
#include <QtCore>
#include "rs_constructionline.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_graphicview.h"
#include "rs_information.h"
#include "rs_modification.h"
* Default constructor.
*
* @param container The container to which we will add
- * entities. Usually that's an RS_Graphic entity but
+ * entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
RS_Creation::RS_Creation(RS_EntityContainer * container, RS_GraphicView * graphicView,
RS_Insert * RS_Creation::createLibraryInsert(RS_LibraryInsertData & data)
{
RS_DEBUG->print("RS_Creation::createLibraryInsert");
- RS_Graphic g;
+ Drawing g;
if (!g.open(data.file, RS2::FormatUnknown))
{
protected:
RS_EntityContainer * container;
- RS_Graphic * graphic;
+ Drawing * graphic;
RS_Document * document;
RS_GraphicView * graphicView;
bool handleUndo;
void setFactoryObject(RS_DialogFactoryInterface * fo);
RS_DialogFactoryInterface * getFactoryObject();
-
void commandMessage(const QString & m);
private:
virtual bool requestTextDialog(RS_Text *) { return false; }
virtual bool requestHatchDialog(RS_Hatch *) { return false; }
virtual void requestOptionsGeneralDialog() {}
- virtual void requestOptionsDrawingDialog(RS_Graphic &) {}
+ virtual void requestOptionsDrawingDialog(Drawing &) {}
#ifdef RS_CAM
- virtual bool requestCamOptionsDialog(RS_Graphic& ) { printf("fake\n"); return false; }
+ virtual bool requestCamOptionsDialog(Drawing& ) { printf("fake\n"); return false; }
#endif
virtual void updateCoordinateWidget(const Vector &, const Vector &, bool = false) {}
virtual void updateMouseWidget(const QString &, const QString &) {}
class RS_Document;
class RS_Entity;
class RS_EventHandler;
-class RS_Graphic;
+class Drawing;
class RS_GraphicView;
class RS_Grid;
class RS_Hatch;
*
* @param graphic Graphic document.
*/
- virtual void requestOptionsDrawingDialog(RS_Graphic & graphic) = 0;
+ virtual void requestOptionsDrawingDialog(Drawing & graphic) = 0;
#ifdef RS_CAM
- virtual bool requestCamOptionsDialog(RS_Graphic & graphic) = 0;
+ virtual bool requestCamOptionsDialog(Drawing & graphic) = 0;
#endif
/**
#include "rs_dimaligned.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_units.h"
#include "rs_constructionline.h"
QString RS_DimAligned::getMeasuredLabel()
{
double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2);
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
QString ret;
if (graphic != NULL)
#include "rs_constructionline.h"
#include "rs_filterdxf.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_information.h"
#include "rs_solid.h"
#include "rs_text.h"
#include "rs_text.h"
#include "rs_solid.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_units.h"
/**
// Definitive dimension line:
double dist = data.definitionPoint.distanceTo(edata.definitionPoint);
- RS_Graphic* graphic = getGraphic();
+ Drawing* graphic = getGraphic();
QString ret;
if (graphic!=NULL) {
Vector RS_Dimension::getNearestRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestRef(coord, dist);
+ return RS_Entity::getNearestRef(coord, dist);
}
Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestSelectedRef(coord, dist);
+ return RS_Entity::getNearestSelectedRef(coord, dist);
}
/**
*/
QString RS_Dimension::getLabel(bool resolve)
{
- if (!resolve) {
+ if (!resolve)
return data.text;
- }
-
- QString ret="";
-
- // One space suppresses the text:
- if (data.text==" ") {
- ret = "";
- }
- // No text prints actual measurement:
- else if (data.text=="") {
- ret = getMeasuredLabel();
- }
+ QString ret = "";
- // Others print the text (<> is replaced by the measurement)
- else {
- ret = data.text;
- ret = ret.replace(QString("<>"), getMeasuredLabel());
- }
+ // One space suppresses the text:
+ if (data.text == " ")
+ ret = "";
+ // No text prints actual measurement:
+ else if (data.text == "")
+ ret = getMeasuredLabel();
+ // Others print the text (<> is replaced by the measurement)
+ else
+ {
+ ret = data.text;
+ ret = ret.replace(QString("<>"), getMeasuredLabel());
+ }
- return ret;
+ return ret;
}
/**
*
* @param forceAutoText Automatically reposition the text label.
*/
-void RS_Dimension::updateCreateDimensionLine(const Vector& p1,
- const Vector& p2, bool arrow1, bool arrow2, bool forceAutoText)
+void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
+ const Vector & p2, bool arrow1, bool arrow2, bool forceAutoText)
{
- // text height (DIMTXT)
- double dimtxt = getTextHeight();
- // text distance to line (DIMGAP)
- double dimgap = getDimensionLineGap();
-
- // length of dimension line:
- double distance = p1.distanceTo(p2);
-
- // do we have to put the arrows outside of the line?
- bool outsideArrows = (distance<getArrowSize()*2.5);
-
- // arrow angles:
- double arrowAngle1, arrowAngle2;
-
- // Create dimension line:
- RS_Line* dimensionLine = new RS_Line(this, RS_LineData(p1, p2));
- dimensionLine->setPen(RS_Pen(RS2::FlagInvalid));
- dimensionLine->setLayer(NULL);
- addEntity(dimensionLine);
-
- if (outsideArrows==false) {
- arrowAngle1 = dimensionLine->getAngle2();
- arrowAngle2 = dimensionLine->getAngle1();
- } else {
- arrowAngle1 = dimensionLine->getAngle1();
- arrowAngle2 = dimensionLine->getAngle2();
-
- // extend dimension line outside arrows
- Vector dir;
- dir.setPolar(getArrowSize()*2, arrowAngle2);
- dimensionLine->setStartpoint(p1 + dir);
- dimensionLine->setEndpoint(p2 - dir);
- }
-
- // Arrows:
- RS_SolidData sd;
- RS_Solid* arrow;
-
- if (arrow1) {
- // arrow 1
- arrow = new RS_Solid(this, sd);
- arrow->shapeArrow(p1,
- arrowAngle1,
- getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
- arrow->setLayer(NULL);
- addEntity(arrow);
- }
-
- if (arrow2) {
- // arrow 2:
- arrow = new RS_Solid(this, sd);
- arrow->shapeArrow(p2,
- arrowAngle2,
- getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
- arrow->setLayer(NULL);
- addEntity(arrow);
- }
-
- // Text label:
- RS_TextData textData;
- Vector textPos;
+ // text height (DIMTXT)
+ double dimtxt = getTextHeight();
+ // text distance to line (DIMGAP)
+ double dimgap = getDimensionLineGap();
+
+ // length of dimension line:
+ double distance = p1.distanceTo(p2);
+
+ // do we have to put the arrows outside of the line?
+ bool outsideArrows = (distance<getArrowSize()*2.5);
+
+ // arrow angles:
+ double arrowAngle1, arrowAngle2;
+
+ // Create dimension line:
+ RS_Line * dimensionLine = new RS_Line(this, RS_LineData(p1, p2));
+ dimensionLine->setPen(RS_Pen(RS2::FlagInvalid));
+ dimensionLine->setLayer(NULL);
+ addEntity(dimensionLine);
+
+ if (outsideArrows == false)
+ {
+ arrowAngle1 = dimensionLine->getAngle2();
+ arrowAngle2 = dimensionLine->getAngle1();
+ }
+ else
+ {
+ arrowAngle1 = dimensionLine->getAngle1();
+ arrowAngle2 = dimensionLine->getAngle2();
+
+ // extend dimension line outside arrows
+ Vector dir;
+ dir.setPolar(getArrowSize() * 2, arrowAngle2);
+ dimensionLine->setStartpoint(p1 + dir);
+ dimensionLine->setEndpoint(p2 - dir);
+ }
+
+ // Arrows:
+ RS_SolidData sd;
+ RS_Solid * arrow;
+
+ if (arrow1)
+ {
+ // arrow 1
+ arrow = new RS_Solid(this, sd);
+ arrow->shapeArrow(p1, arrowAngle1, getArrowSize());
+ arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setLayer(NULL);
+ addEntity(arrow);
+ }
+
+ if (arrow2)
+ {
+ // arrow 2:
+ arrow = new RS_Solid(this, sd);
+ arrow->shapeArrow(p2, arrowAngle2, getArrowSize());
+ arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setLayer(NULL);
+ addEntity(arrow);
+ }
+
+ // Text label:
+ RS_TextData textData;
+ Vector textPos;
double dimAngle1 = dimensionLine->getAngle1();
double textAngle;
- bool corrected=false;
+ bool corrected = false;
textAngle = RS_Math::makeAngleReadable(dimAngle1, true, &corrected);
- if (data.middleOfText.valid && !forceAutoText) {
- textPos = data.middleOfText;
- } else {
- textPos = dimensionLine->getMiddlepoint();
-
- Vector distV;
-
- // rotate text so it's readable from the bottom or right (ISO)
- // quadrant 1 & 4
- if (corrected) {
- distV.setPolar(dimgap + dimtxt/2.0, dimAngle1-M_PI/2.0);
- } else {
- distV.setPolar(dimgap + dimtxt/2.0, dimAngle1+M_PI/2.0);
- }
-
- // move text away from dimension line:
- textPos+=distV;
- //// the next update should still be able to adjust this
- //// auto text position. leave it invalid
+ if (data.middleOfText.valid && !forceAutoText)
+ {
+ textPos = data.middleOfText;
+ }
+ else
+ {
+ textPos = dimensionLine->getMiddlepoint();
+
+ Vector distV;
+
+ // rotate text so it's readable from the bottom or right (ISO)
+ // quadrant 1 & 4
+ if (corrected)
+ {
+ distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 - M_PI / 2.0);
+ }
+ else
+ {
+ distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 + M_PI / 2.0);
+ }
+
+ // move text away from dimension line:
+ textPos += distV;
+ //// the next update should still be able to adjust this
+ //// auto text position. leave it invalid
data.middleOfText = textPos;
- }
-
- textData = RS_TextData(textPos,
- dimtxt, 30.0,
- RS2::VAlignMiddle,
- RS2::HAlignCenter,
- RS2::LeftToRight,
- RS2::Exact,
- 1.0,
- getLabel(),
- "standard",
- textAngle);
-
- RS_Text* text = new RS_Text(this, textData);
-
- // move text to the side:
- Vector distH;
- if (text->getUsedTextWidth()>distance) {
- distH.setPolar(text->getUsedTextWidth()/2.0
- +distance/2.0+dimgap, textAngle);
- text->move(distH);
- }
- text->setPen(RS_Pen(RS2::FlagInvalid));
- text->setLayer(NULL);
- addEntity(text);
+ }
+
+ textData = RS_TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter,
+ RS2::LeftToRight, RS2::Exact, 1.0, getLabel(), "standard", textAngle);
+
+ RS_Text * text = new RS_Text(this, textData);
+
+ // move text to the side:
+ Vector distH;
+
+ if (text->getUsedTextWidth() > distance)
+ {
+ distH.setPolar(text->getUsedTextWidth() / 2.0
+ + distance / 2.0 + dimgap, textAngle);
+ text->move(distH);
+ }
+
+ text->setPen(RS_Pen(RS2::FlagInvalid));
+ text->setLayer(NULL);
+ addEntity(text);
}
Vector RS_Dimension::getDefinitionPoint()
#include "rs_constructionline.h"
#include "rs_text.h"
#include "rs_solid.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_units.h"
/**
// Definitive dimension line:
double dist = dimP1.distanceTo(dimP2);
- RS_Graphic* graphic = getGraphic();
+ Drawing * graphic = getGraphic();
QString ret;
- if (graphic!=NULL)
+
+ if (graphic != NULL)
{
ret = RS_Units::formatLinear(dist, graphic->getUnit(),
graphic->getLinearFormat(), graphic->getLinearPrecision());
{
ret = QString("%1").arg(dist);
}
+//It's properly creating the label...
+//printf("RS_DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data());
return ret;
}
#include "rs_dimradial.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_solid.h"
#include "rs_text.h"
#include "rs_units.h"
// Definitive dimension line:
double dist = data.definitionPoint.distanceTo(edata.definitionPoint);
- RS_Graphic* graphic = getGraphic();
+ Drawing* graphic = getGraphic();
QString ret;
if (graphic!=NULL) {
#include "rs_ellipse.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_graphicview.h"
#include "rs_information.h"
#include "paintintf.h"
#include "rs_debug.h"
#include "rs_document.h"
#include "rs_ellipse.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_graphicview.h"
#include "rs_insert.h"
#include "rs_layer.h"
* or the parent's parent graphic or NULL if none of the parents
* are stored in a graphic.
*/
-RS_Graphic * RS_Entity::getGraphic()
+Drawing * RS_Entity::getGraphic()
{
if (rtti() == RS2::EntityGraphic)
- return (RS_Graphic *)this;
+ return (Drawing *)this;
else if (parent == NULL)
return NULL;
else
*/
void RS_Entity::addGraphicVariable(const QString & key, double val, int code)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL)
graphic->addVariable(key, val, code);
*/
void RS_Entity::addGraphicVariable(const QString & key, int val, int code)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL)
graphic->addVariable(key, val, code);
*/
void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int code)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL)
graphic->addVariable(key, val, code);
*/
double RS_Entity::getGraphicVariableDouble(const QString & key, double def)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
double ret = def;
if (graphic != NULL)
*/
int RS_Entity::getGraphicVariableInt(const QString & key, int def)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
int ret = def;
if (graphic != NULL)
*/
QString RS_Entity::getGraphicVariableString(const QString & key, const QString & def)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
QString ret = def;
if (graphic != NULL)
*/
RS2::Unit RS_Entity::getGraphicUnit()
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
RS2::Unit ret = RS2::None;
if (graphic != NULL)
*/
void RS_Entity::setLayer(const QString & name)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL)
layer = graphic->findLayer(name);
*/
void RS_Entity::setLayerToActive()
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL)
layer = graphic->getActiveLayer();
//styleFactor = getStyleFactor();
// the factor caused by the unit:
RS2::Unit unit = RS2::None;
- RS_Graphic * g = getGraphic();
+ Drawing * g = getGraphic();
if (g != NULL)
{
if (view->isPrinting() || view->isPrintPreview() || view->isDraftMode() == false)
{
- RS_Graphic * graphic = getGraphic();
+ Drawing * graphic = getGraphic();
if (graphic != NULL && graphic->getPaperScale() > 1.0e-6)
styleFactor /= graphic->getPaperScale();
class RS_Circle;
class RS_Document;
class RS_EntityContainer;
-class RS_Graphic;
+class Drawing;
class RS_GraphicView;
class RS_Insert;
class RS_Line;
virtual double getLength();
RS_EntityContainer * getParent() const;
void setParent(RS_EntityContainer * p);
- RS_Graphic * getGraphic();
+ Drawing * getGraphic();
RS_Block * getBlock();
RS_Insert * getInsert();
RS_Entity * getBlockOrInsert();
*/
void RS_EventHandler::keyReleaseEvent(QKeyEvent* e)
{
- if (actionIndex>=0 && currentActions[actionIndex]!=NULL &&
- !currentActions[actionIndex]->isFinished()) {
- currentActions[actionIndex]->keyReleaseEvent(e);
- } else {
- if (defaultAction!=NULL) {
- defaultAction->keyReleaseEvent(e);
- }
- else {
+ if (actionIndex >= 0 && currentActions[actionIndex] != NULL &&
+ !currentActions[actionIndex]->isFinished())
+ {
+ currentActions[actionIndex]->keyReleaseEvent(e);
+ }
+ else
+ {
+ if (defaultAction != NULL)
+ {
+ defaultAction->keyReleaseEvent(e);
+ }
+ else
+ {
e->ignore();
}
- //RS_DEBUG->print("currently no action defined");
- }
+ //RS_DEBUG->print("currently no action defined");
+ }
}
/**
if (actionIndex >= 0 && currentActions[actionIndex] != NULL
&& !currentActions[actionIndex]->isFinished())
{
-// int commaPos = cmd.find(',');
int commaPos = cmd.indexOf(',');
RS_DEBUG->print("RS_EventHandler::commandEvent: 001");
bool ok1, ok2;
return;
// Predecessor of the new action or NULL:
- RS_ActionInterface* predecessor = NULL;
+ RS_ActionInterface * predecessor = NULL;
// Suspend current action:
if (actionIndex >= 0 && currentActions[actionIndex] != NULL
// Move up actionstack (optimize):
for(int i=0; i<RS_MAXACTIONS-1; ++i)
- {
currentActions[i] = currentActions[i + 1];
- }
}
else if (actionIndex < RS_MAXACTIONS - 1)
- {
actionIndex++;
- }
// Set current action:
currentActions[actionIndex] = action;
*/
void RS_EventHandler::cleanUp()
{
- RS_DEBUG->print("RS_EventHandler::cleanUp");
-
- int o=0; // old index
- int n=0; // new index
- int resume=0; // index of action to resume
- bool doResume=false; // do we need to resume an action
- actionIndex = -1;
-
- debugActions();
- do {
- // search first used action (o)
- while (currentActions[o]==NULL && o<RS_MAXACTIONS) {
- o++;
- }
+ RS_DEBUG->print("RS_EventHandler::cleanUp");
- // delete action if it is finished
- if (o<RS_MAXACTIONS && currentActions[o]!=NULL &&
- currentActions[o]->isFinished()) {
- delete currentActions[o];
- currentActions[o] = NULL;
+ int o = 0; // old index
+ int n = 0; // new index
+ int resume = 0; // index of action to resume
+ bool doResume = false; // do we need to resume an action
+ actionIndex = -1;
- doResume = true;
- }
+ debugActions();
- // move a running action up in the stack
- if (o<RS_MAXACTIONS && currentActions[o]!=NULL) {
- if (n!=o) {
- currentActions[n] = currentActions[o];
- resume = n;
- currentActions[o] = NULL;
- } else {
- if (o<RS_MAXACTIONS) {
- o++;
- }
- }
- actionIndex = n;
- if (n<RS_MAXACTIONS-1) {
- n++;
- }
- }
- } while (o<RS_MAXACTIONS);
-
- debugActions();
-
- // Resume last used action:
- if (doResume) {
- if (currentActions[resume]!=NULL &&
- !currentActions[resume]->isFinished()) {
-
- currentActions[resume]->resume();
- currentActions[resume]->showOptions();
- } else {
- if (defaultAction!=NULL) {
- defaultAction->resume();
- defaultAction->showOptions();
- }
- }
- }
- RS_DEBUG->print("RS_EventHandler::cleanUp: OK");
+ do
+ {
+ // search first used action (o)
+ while (currentActions[o] == NULL && o < RS_MAXACTIONS)
+ o++;
+
+ // delete action if it is finished
+ if (o < RS_MAXACTIONS && currentActions[o] != NULL
+ && currentActions[o]->isFinished())
+ {
+ delete currentActions[o];
+ currentActions[o] = NULL;
+ doResume = true;
+ }
+
+ // move a running action up in the stack
+ if (o < RS_MAXACTIONS && currentActions[o] != NULL)
+ {
+ if (n != o)
+ {
+ currentActions[n] = currentActions[o];
+ resume = n;
+ currentActions[o] = NULL;
+ }
+ else
+ {
+ if (o < RS_MAXACTIONS)
+ o++;
+ }
+
+ actionIndex = n;
+
+ if (n < RS_MAXACTIONS - 1)
+ n++;
+ }
+ }
+ while (o < RS_MAXACTIONS);
+
+ debugActions();
+
+ // Resume last used action:
+ if (doResume)
+ {
+ if (currentActions[resume] != NULL && !currentActions[resume]->isFinished())
+ {
+ currentActions[resume]->resume();
+ currentActions[resume]->showOptions();
+ }
+ else
+ {
+ if (defaultAction != NULL)
+ {
+ defaultAction->resume();
+ defaultAction->showOptions();
+ }
+ }
+ }
+
+ RS_DEBUG->print("RS_EventHandler::cleanUp: OK");
}
/**
* of the given file.
*
* @param graphic The container to which we will add
- * entities. Usually that's an RS_Graphic entity but
+ * entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
* @param file Path and name of the file to import.
*/
-bool RS_FileIO::fileImport(RS_Graphic & graphic, const QString & file, RS2::FormatType type)
+bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type)
{
RS_DEBUG->print("Trying to import file '%s'...", file.toLatin1().data());
*
* @param file Path and name of the file to import.
*/
-bool RS_FileIO::fileExport(RS_Graphic & graphic, const QString & file, RS2::FormatType type)
+bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type)
{
RS_DEBUG->print("RS_FileIO::fileExport");
//RS_DEBUG->print("Trying to export file '%s'...", file.latin1());
#define RS_FILEIO RS_FileIO::instance()
-class RS_Graphic;
+class Drawing;
/**
* API Class for importing files.
RS_FilterInterface * getImportFilter(RS2::FormatType t);
RS_FilterInterface * getExportFilter(RS2::FormatType t);
- bool fileImport(RS_Graphic & graphic, const QString & file,
+ bool fileImport(Drawing & graphic, const QString & file,
RS2::FormatType type = RS2::FormatUnknown);
- bool fileExport(RS_Graphic & graphic, const QString & file,
+ bool fileExport(Drawing & graphic, const QString & file,
RS2::FormatType type = RS2::FormatUnknown);
RS2::FormatType detectFormat(const QString & file);
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterCXF::fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/)
+bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
RS_DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data());
*
* @param file Full path to the CXF file that will be written.
*/
-bool RS_FilterCXF::fileExport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/)
+bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toLatin1().data());
return (t==RS2::FormatCXF);
}*/
- virtual bool fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/);
- virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/);
+ virtual bool fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/);
+ virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/);
void stream(std::ofstream & fs, double value);
};
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterDXF::fileImport(RS_Graphic & g, const QString & file, RS2::FormatType /*type*/)
+bool RS_FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
RS_DEBUG->print("RS_FilterDXF::fileImport");
//RS_DEBUG->timestamp();
// update document's variable list:
if (currentContainer->rtti() == RS2::EntityGraphic)
- ((RS_Graphic *)currentContainer)->addVariable(QString(key), Vector(v1, v2, v3), code);
+ ((Drawing *)currentContainer)->addVariable(QString(key), Vector(v1, v2, v3), code);
}
/**
// update document's variable list:
if (currentContainer->rtti()==RS2::EntityGraphic) {
- ((RS_Graphic*)currentContainer)->addVariable(QString(key),
+ ((Drawing*)currentContainer)->addVariable(QString(key),
QString(value), code);
}
}
// update document's variable list:
if (currentContainer->rtti()==RS2::EntityGraphic) {
- ((RS_Graphic*)currentContainer)->addVariable(QString(key),
+ ((Drawing*)currentContainer)->addVariable(QString(key),
value, code);
}
}
// update document's variable list:
if (currentContainer->rtti() == RS2::EntityGraphic)
{
- ((RS_Graphic *)currentContainer)->addVariable(QString(key), value, code);
+ ((Drawing *)currentContainer)->addVariable(QString(key), value, code);
}
}
*
* @param file Full path to the DXF file that will be written.
*/
-bool RS_FilterDXF::fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type)
+bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType type)
{
RS_DEBUG->print("RS_FilterDXF::fileExport: exporting file '%s'...",
(const char *)QFile::encodeName(file));
}*/
// Import:
- virtual bool fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/);
+ virtual bool fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/);
// Methods from DL_CreationInterface:
virtual void addLayer(const DL_LayerData & data);
virtual void setVariableDouble(const char * key, double value, int code);
// Export:
- virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type);
+ virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type);
void writeVariables(DL_WriterA & dw);
void writeLayer(DL_WriterA & dw, RS_Layer * l);
private:
/** Pointer to the graphic we currently operate on. */
- RS_Graphic * graphic;
+ Drawing * graphic;
/** File name. Used to find out the full path of images. */
QString file;
/** string for concatinating text parts of MTEXT entities. */
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterDXF1::fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/)
+bool RS_FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
{
RS_DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
return false;
}*/
- virtual bool fileImport(RS_Graphic& g, const QString& file, RS2::FormatType /*type*/);
+ virtual bool fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/);
- virtual bool fileExport(RS_Graphic& /*g*/, const QString& /*file*/,
+ virtual bool fileExport(Drawing& /*g*/, const QString& /*file*/,
RS2::FormatType /*type*/) {
RS_DEBUG->print(RS_Debug::D_WARNING,
"Exporting of QCad 1.x file not implemented");
protected:
/** Pointer to the graphic we currently operate on. */
- RS_Graphic* graphic;
+ Drawing* graphic;
FILE* fPointer; // File pointer
char* fBuf; // Filebuffer
int fBufP; // Filebuffer-Pointer (walks through 'fBuf')
#define RS_FILTERINTERFACE_H
#include <QtCore>
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* This is the interface that must be implemented for all
* class should read a file from disk and put the entities
* into the current entity container.
*/
- virtual bool fileImport(RS_Graphic & g, const QString & file, RS2::FormatType type) = 0;
+ virtual bool fileImport(Drawing & g, const QString & file, RS2::FormatType type) = 0;
/**
* The implementation of this method in a inherited format
* class should write the entities in the current entity container
* to a file on the disk.
*/
- virtual bool fileExport(RS_Graphic & g, const QString & file, RS2::FormatType type) = 0;
+ virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type) = 0;
protected:
void addImportFormat(RS2::FormatType type);
protected:
//! Pointer to the graphic we currently operate on.
- //RS_Graphic* graphic;
+ //Drawing* graphic;
//! Vector of file extensions this filter can import.
// Q3ValueList<RS2::FormatType> importFormats;
#include "rs_blocklist.h"
/**
- * Class for representing a font. This is implemented as a RS_Graphic
+ * Class for representing a font. This is implemented as a Drawing
* with a name (the font name) and several blocks, one for each letter
* in the font.
*
#include "rs_application.h"
#include "rs_block.h"
#include "rs_eventhandler.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_grid.h"
#include "rs_insert.h"
#include "rs_layer.h"
* connected to this view is a graphic and valid.
* NULL otherwise.
*/
-RS_Graphic * RS_GraphicView::getGraphic()
+Drawing * RS_GraphicView::getGraphic()
{
if (container != NULL && container->rtti() == RS2::EntityGraphic)
- return (RS_Graphic*)container;
+ return (Drawing*)container;
else
return NULL;
}
{
if (container != NULL)
{
- RS_Graphic * g = container->getGraphic();
+ Drawing * g = container->getGraphic();
if (g != NULL)
return g->isGridOn();
{
RS_DEBUG->print("RS_GraphicView::mouseMoveEvent begin");
- RS_Graphic * graphic = NULL;
+ Drawing * graphic = NULL;
if (container->rtti() == RS2::EntityGraphic)
- graphic = (RS_Graphic *)container;
+ graphic = (Drawing *)container;
RS_DEBUG->print("RS_GraphicView::mouseMoveEvent 001");
if (simulationRunning)
return;
- RS_Graphic * graphic = container->getGraphic();
+ Drawing * graphic = container->getGraphic();
if (graphic == NULL)
return;
{
double uf = 1.0; // unit factor
double wf = 1.0; // width factor
- RS_Graphic * graphic = container->getGraphic();
+ Drawing * graphic = container->getGraphic();
if (graphic != NULL)
{
if (container == NULL)
return;
- RS_Graphic * graphic = container->getGraphic();
+ Drawing * graphic = container->getGraphic();
if (graphic == NULL)
return;
void cleanUp();
- RS_Graphic * getGraphic();
+ Drawing * getGraphic();
void setDrawingMode(RS2::DrawingMode m);
RS2::DrawingMode getDrawingMode();
void setDeleteMode(bool m);
#include "rs_grid.h"
#include "rs_units.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "settings.h"
/**
if (!graphicView->isGridOn())
return;
- RS_Graphic * graphic = graphicView->getGraphic();
+ Drawing * graphic = graphicView->getGraphic();
// auto scale grid?
settings.beginGroup("Appearance");
#include <QtCore>
#include "rs_graphicview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_information.h"
#include "rs_pattern.h"
#include "rs_patternlist.h"
-/****************************************************************************
-** $Id: rs_infoarea.cpp 1892 2004-07-09 23:54:59Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_infoarea.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_infoarea.h"
-/****************************************************************************
-** $Id: rs_infoarea.h 1892 2004-07-09 23:54:59Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_INFOAREA_H
#define RS_INFOAREA_H
-/****************************************************************************
-** $Id: rs_information.cpp 2378 2005-05-16 17:05:15Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_information.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_information.h"
#include "rs_constructionline.h"
-
/**
* Default constructor.
*
* @param container The container to which we will add
- * entities. Usually that's an RS_Graphic entity but
+ * entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
-RS_Information::RS_Information(RS_EntityContainer& container) {
- this->container = &container;
+RS_Information::RS_Information(RS_EntityContainer& container)
+{
+ this->container = &container;
}
-
-
/**
* @return true: if the entity is a dimensioning enity.
* false: otherwise
*/
-bool RS_Information::isDimension(RS2::EntityType type) {
+bool RS_Information::isDimension(RS2::EntityType type)
+{
if (type==RS2::EntityDimAligned ||
type==RS2::EntityDimLinear ||
type==RS2::EntityDimRadial ||
* @param coord Coordinate (typically a mouse coordinate)
*
* @return the coordinate found or an invalid vector
- * if there are no elements at all in this graphics
+ * if there are no elements at all in this graphics
* container.
*/
Vector RS_Information::getNearestEndpoint(const Vector& coord,
/**
- * Gets the nearest point to the given coordinate which is on an entity.
+ * Gets the nearest point to the given coordinate which is on an entity.
*
* @param coord Coordinate (typically a mouse coordinate)
- * @param dist Pointer to a double which will contain the
+ * @param dist Pointer to a double which will contain the
* measured distance after return or NULL
* @param entity Pointer to a pointer which will point to the
* entity on which the point is or NULL
*
* @return the coordinate found or an invalid vector
- * if there are no elements at all in this graphics
+ * if there are no elements at all in this graphics
* container.
*/
Vector RS_Information::getNearestPointOnEntity(const Vector& coord,
* Gets the nearest entity to the given coordinate.
*
* @param coord Coordinate (typically a mouse coordinate)
- * @param dist Pointer to a double which will contain the
+ * @param dist Pointer to a double which will contain the
* masured distance after return
* @param level Level of resolving entities.
*
- * @return the entity found or NULL if there are no elements
+ * @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,
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;
RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1");
Vector ret1(false);
Vector ret2(false);
- //if ( 0 <= t_a && t_a <= 1 ) {
+ //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);
return ((counter%2)==1);
}
-
+
-/****************************************************************************
-** $Id: rs_information.h 1926 2004-11-20 00:42:21Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_INFORMATION_H
#define RS_INFORMATION_H
-/****************************************************************************
-** $Id: rs_insert.cpp 2371 2005-04-29 11:44:39Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_insert.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_insert.h"
#include "rs_block.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* @param parent The graphic this block belongs to.
if (updateEnabled == false)
return;
- clear();
+ clear();
- RS_Block * blk = getBlockForInsert();
+ RS_Block * blk = getBlockForInsert();
if (blk == NULL)
{
- //return NULL;
+ //return NULL;
RS_DEBUG->print("RS_Insert::update: Block is NULL");
- return;
- }
+ return;
+ }
- if (isUndone())
+ if (isUndone())
{
RS_DEBUG->print("RS_Insert::update: Insert is in undo list");
- return;
- }
+ return;
+ }
if (fabs(data.scaleFactor.x) < 1.0e-6 || fabs(data.scaleFactor.y) < 1.0e-6)
{
return;
}
- RS_Pen tmpPen;
+ RS_Pen tmpPen;
/*Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity* e;
- while ( (e = it.current()) != NULL ) {
- ++it;*/
+ RS_Entity* e;
+ while ( (e = it.current()) != NULL ) {
+ ++it;*/
RS_DEBUG->print("RS_Insert::update: cols: %d, rows: %d", data.cols, data.rows);
RS_DEBUG->print("RS_Insert::update: block has %d entities", blk->count());
- for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity())
+ for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity())
{
- for(int c=0; c<data.cols; ++c)
+ for(int c=0; c<data.cols; ++c)
{
- RS_DEBUG->print("RS_Insert::update: col %d", c);
+ RS_DEBUG->print("RS_Insert::update: col %d", c);
for(int r=0; r<data.rows; ++r)
{
- RS_DEBUG->print("RS_Insert::update: row %d", r);
+ RS_DEBUG->print("RS_Insert::update: row %d", r);
- if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate)
+ if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate)
{
RS_DEBUG->print("RS_Insert::update: updating sub-insert");
- ((RS_Insert *)e)->update();
- }
+ ((RS_Insert *)e)->update();
+ }
RS_DEBUG->print("RS_Insert::update: cloning entity");
- RS_Entity * ne = e->clone();
- ne->initId();
+ RS_Entity * ne = e->clone();
+ ne->initId();
ne->setUpdateEnabled(false);
- ne->setParent(this);
- ne->setVisible(getFlag(RS2::FlagVisible));
+ ne->setParent(this);
+ ne->setVisible(getFlag(RS2::FlagVisible));
RS_DEBUG->print("RS_Insert::update: transforming entity");
- // Move:
+ // Move:
RS_DEBUG->print("RS_Insert::update: move 1");
if (fabs(data.scaleFactor.x) > 1.0e-6 && fabs(data.scaleFactor.y) > 1.0e-6)
{
- ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c,
+ ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c,
data.spacing.y / data.scaleFactor.y * r));
}
else
{
- ne->move(data.insertionPoint);
+ ne->move(data.insertionPoint);
}
// Move because of block base point:
RS_DEBUG->print("RS_Insert::update: move 2");
- ne->move(blk->getBasePoint() * -1);
- // Scale:
+ ne->move(blk->getBasePoint() * -1);
+ // Scale:
RS_DEBUG->print("RS_Insert::update: scale");
- ne->scale(data.insertionPoint, data.scaleFactor);
- // Rotate:
+ ne->scale(data.insertionPoint, data.scaleFactor);
+ // Rotate:
RS_DEBUG->print("RS_Insert::update: rotate");
- ne->rotate(data.insertionPoint, data.angle);
- // Select:
- ne->setSelected(isSelected());
+ ne->rotate(data.insertionPoint, data.angle);
+ // Select:
+ ne->setSelected(isSelected());
- // individual entities can be on indiv. layers
- tmpPen = ne->getPen(false);
+ // individual entities can be on indiv. layers
+ tmpPen = ne->getPen(false);
- // color from block (free floating):
- if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock))
- tmpPen.setColor(getPen().getColor());
+ // color from block (free floating):
+ if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock))
+ tmpPen.setColor(getPen().getColor());
- // line width from block (free floating):
- if (tmpPen.getWidth() == RS2::WidthByBlock)
- tmpPen.setWidth(getPen().getWidth());
+ // line width from block (free floating):
+ if (tmpPen.getWidth() == RS2::WidthByBlock)
+ tmpPen.setWidth(getPen().getWidth());
- // line type from block (free floating):
- if (tmpPen.getLineType() == RS2::LineByBlock)
- tmpPen.setLineType(getPen().getLineType());
+ // line type from block (free floating):
+ if (tmpPen.getLineType() == RS2::LineByBlock)
+ tmpPen.setLineType(getPen().getLineType());
- // now that we've evaluated all flags, let's strip them:
- // TODO: strip all flags (width, line type)
- //tmpPen.setColor(tmpPen.getColor().stripFlags());
+ // now that we've evaluated all flags, let's strip them:
+ // TODO: strip all flags (width, line type)
+ //tmpPen.setColor(tmpPen.getColor().stripFlags());
- ne->setPen(tmpPen);
+ ne->setPen(tmpPen);
ne->setUpdateEnabled(true);
}
RS_DEBUG->print("RS_Insert::update: adding new entity");
- addEntity(ne);
- }
- }
- }
+ addEntity(ne);
+ }
+ }
+ }
calculateBorders();
update();
}
-
-
-void RS_Insert::rotate(Vector center, double angle) {
+void RS_Insert::rotate(Vector center, double angle)
+{
RS_DEBUG->print("RS_Insert::rotate1: insertionPoint: %f/%f "
"/ center: %f/%f",
data.insertionPoint.x, data.insertionPoint.y,
center.x, center.y);
data.insertionPoint.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle+angle);
+ data.angle = RS_Math::correctAngle(data.angle + angle);
RS_DEBUG->print("RS_Insert::rotate2: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
update();
}
-
-
-void RS_Insert::scale(Vector center, Vector factor) {
+void RS_Insert::scale(Vector center, Vector factor)
+{
RS_DEBUG->print("RS_Insert::scale1: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
data.insertionPoint.scale(center, factor);
update();
}
-
-
-void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2) {
- data.insertionPoint.mirror(axisPoint1, axisPoint2);
+void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2)
+{
+ data.insertionPoint.mirror(axisPoint1, axisPoint2);
Vector vec;
vec.setPolar(1.0, data.angle);
- vec.mirror(Vector(0.0,0.0), axisPoint2-axisPoint1);
+ vec.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1);
data.angle = vec.angle();
- data.scaleFactor.y*=-1;
+ data.scaleFactor.y *= -1;
update();
}
-
-std::ostream& operator << (std::ostream& os, const RS_Insert& i) {
+std::ostream & operator<<(std::ostream & os, const RS_Insert & i)
+{
os << " Insert: " << i.getData() << std::endl;
return os;
}
-
-/****************************************************************************
-** $Id: rs_insert.h 2367 2005-04-04 16:57:36Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_INSERT_H
#define RS_INSERT_H
#include "rs_entitycontainer.h"
#include "rs_block.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* Holds the data that defines an insert.
-/****************************************************************************
-** $Id: rs_layer.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_layer.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_layer.h"
-//#include <iostream>
#include "rs_color.h"
#include "rs_math.h"
-/****************************************************************************
-** $Id: rs_layer.h 1822 2004-02-29 00:29:32Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_LAYER_H
#define RS_LAYER_H
-/****************************************************************************
-** $Id: rs_layerlist.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_layerlist.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_layerlist.h"
-/****************************************************************************
-** $Id: rs_layerlist.h 1869 2004-04-09 19:56:42Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_LAYERLIST_H
#define RS_LAYERLIST_H
-/****************************************************************************
-** $Id: rs_layerlistlistener.h 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_LAYERLISTLISTENER_H
#define RS_LAYERLISTLISTENER_H
-/****************************************************************************
-** $Id: rs_leader.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_leader.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_leader.h"
-/****************************************************************************
-** $Id: rs_leader.h 2367 2005-04-04 16:57:36Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_LEADER_H
#define RS_LEADER_H
+// rs_line.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_line.h"
#include "rs_debug.h"
#include "rs_graphicview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "paintintf.h"
/**
-/****************************************************************************
-** $Id: rs_line.h 1907 2004-09-04 19:56:42Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_LINE_H
#define RS_LINE_H
-/****************************************************************************
-** $Id: rs_linetypepattern.cpp 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
+// rs_linetypepattern.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_linetypepattern.h"
+RS_LineTypePattern::RS_LineTypePattern(int count ...)
+{
+ va_list ap;
+ int i = 0;
+ num = count;
+
+ va_start(ap, count);
+ pattern = new double[num];
+
+ for(i=0; i<count; i++)
+ pattern[i] = va_arg(ap, double);
+ va_end(ap);
+}
+RS_LineTypePattern::~RS_LineTypePattern()
+{
+ delete[] pattern;
+}
-/****************************************************************************
-** $Id: rs_linetypepattern.h 1676 2003-08-08 14:05:26Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-
#ifndef RS_LINETYPEPATTERN_H
#define RS_LINETYPEPATTERN_H
/**
* Stores a line type pattern.
*/
-class RS_LineTypePattern {
-public:
- RS_LineTypePattern(int count ...) {
- va_list ap;
- int i=0;
- num = count;
-
- va_start(ap, count);
- pattern = new double[num];
- for (i=0; i<count; i++) {
- pattern[i] = va_arg(ap, double);
- }
- va_end(ap);
- }
-
- ~RS_LineTypePattern() {
- delete[] pattern;
- }
-
-public:
- double* pattern;
- int num;
+class RS_LineTypePattern
+{
+ public:
+ RS_LineTypePattern(int count ...);
+ ~RS_LineTypePattern();
+
+ public:
+ double * pattern;
+ int num;
};
// Create line patterns
6, 6.0, -2.9, 0.15, -2.9, 0.15, -2.9);
static RS_LineTypePattern patternDivideLineX2(
6, 24.0, -11.9, 0.15, -11.9, 0.15, -11.9);
-
+
static RS_LineTypePattern patternCenterLine(4, 32.0, -6.0, 6.0, -6.0);
static RS_LineTypePattern patternCenterLine2(4, 16.0, -3.0, 3.0, -3.0);
static RS_LineTypePattern patternCenterLineX2(4, 64.0, -12.0, 12.0, -12.0);
-/****************************************************************************
-** $Id: rs_mainwindowinterface.h 1944 2004-12-17 04:31:59Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_MAINWINDOWINTERFACE_H
#define RS_MAINWINDOWINTERFACE_H
-/****************************************************************************
-** $Id: rs_math.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_math.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_math.h"
-/****************************************************************************
-** $Id: rs_math.h 2392 2005-05-17 13:52:38Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_MATH_H
#define RS_MATH_H
+// rs_modification.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_modification.h"
#include "rs_clipboard.h"
#include "rs_creation.h"
#include "rs_entity.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_information.h"
#include "rs_insert.h"
#include "rs_polyline.h"
* Default constructor.
*
* @param container The container to which we will add
- * entities. Usually that's an RS_Graphic entity but
+ * entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
* @param graphicView Pointer to graphic view or NULL if you don't want the
* any views to be updated.
/**
* Copies all selected entities from the given container to the clipboard.
* Layers and blocks that are needed are also copied if the container is
- * or is part of an RS_Graphic.
+ * or is part of an Drawing.
*
* @param container The entity container.
* @param ref Reference point. The entities will be moved by -ref.
/**
* Copies the given entity from the given container to the clipboard.
* Layers and blocks that are needed are also copied if the container is
- * or is part of an RS_Graphic.
+ * or is part of an Drawing.
*
* @param e The entity.
* @param ref Reference point. The entities will be moved by -ref.
/**
* Pastes all entities from the clipboard into the container.
* Layers and blocks that are needed are also copied if the container is
- * or is part of an RS_Graphic.
+ * or is part of an Drawing.
*
* @param data Paste data.
* @param source The source from where to paste. NULL means the source
* is the clipboard.
*/
-void RS_Modification::paste(const RS_PasteData& data, RS_Graphic* source) {
+void RS_Modification::paste(const RS_PasteData& data, Drawing* source) {
if (graphic==NULL) {
RS_DEBUG->print(RS_Debug::D_WARNING,
-/****************************************************************************
-** $Id: rs_modification.h 1946 2004-12-24 19:27:43Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_MODIFICATION_H
#define RS_MODIFICATION_H
* There's no interaction handled in this class.
*
* All modifications can be undone / redone if the container
- * is a RS_Graphic.
+ * is a Drawing.
*
* This class is connected to an entity container and
* can be connected to a graphic view.
public:
void copyLayers(RS_Entity * e);
void copyBlocks(RS_Entity * e);
- void paste(const RS_PasteData & data, RS_Graphic * source = NULL);
+ void paste(const RS_PasteData & data, Drawing * source = NULL);
bool move(RS_MoveData & data);
bool rotate(RS_RotateData & data);
protected:
RS_EntityContainer * container;
- RS_Graphic * graphic;
+ Drawing * graphic;
RS_Document * document;
RS_GraphicView * graphicView;
bool handleUndo;
-/****************************************************************************
-** $Id: rs_pattern.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_pattern.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_pattern.h"
#include <QtCore>
#include "rs_system.h"
#include "rs_fileio.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* Constructor.
return false;
}
- RS_Graphic * gr = new RS_Graphic();
+ Drawing * gr = new Drawing();
// TODO: Find out why the new dxf filter doesn't work for patterns:
RS_FILEIO->fileImport(*gr, path, RS2::FormatDXF1);
-/****************************************************************************
-** $Id: rs_pattern.h 1819 2004-02-18 16:03:00Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_PATTERN_H
#define RS_PATTERN_H
-/****************************************************************************
-** $Id: rs_patternlist.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_patternlist.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_patternlist.h"
-/****************************************************************************
-** $Id: rs_patternlist.h 1915 2004-09-20 12:08:35Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_PATTERNLIST_H
#define RS_PATTERNLIST_H
-/****************************************************************************
-** $Id: rs_pen.h 1760 2003-10-13 19:52:37Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_PEN_H
#define RS_PEN_H
-/****************************************************************************
-** $Id: rs_point.cpp 1907 2004-09-04 19:56:42Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_point.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_point.h"
-/****************************************************************************
-** $Id: rs_point.h 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_POINT_H
#define RS_POINT_H
-/****************************************************************************
-** $Id: rs_polyline.cpp 1959 2005-03-08 14:09:02Z js $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_polyline.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/01/2010 Added this text. :-)
+//
#include "rs_polyline.h"
-/****************************************************************************
-** $Id: rs_polyline.h 2367 2005-04-04 16:57:36Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_POLYLINE_H
#define RS_POLYLINE_H
-// preview.cpp
+// rs_preview.cpp
//
+// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
// (C) 2010 Underground Software
+// rs_previewactioninterface.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_previewactioninterface.h"
-/****************************************************************************
-** $Id: rs_python.cpp 1741 2003-09-30 22:50:17Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_python.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_python.h"
Py_XDECREF(mod);
} else {
printf("*** ERROR LOADING SCRIPT '%s' ***\n", script.latin1());
- PyErr_Print();
+ PyErr_Print();
}
Py_XDECREF(modname);
//Py_Finalize();
-/****************************************************************************
-** $Id: rs_python.h 1960 2005-03-12 12:22:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_PYTHON_H
#define RS_PYTHON_H
#include "Python.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#define RS_PYTHON RS_Python::instance()
public:
static RS_Python* instance();
- void setGraphic(RS_Graphic* g) {
+ void setGraphic(Drawing* g) {
graphic = g;
}
- RS_Graphic* getGraphic() {
+ Drawing* getGraphic() {
return graphic;
}
private:
static RS_Python* uniqueInstance;
- RS_Graphic* graphic;
+ Drawing* graphic;
};
#endif
#include "rs_entitycontainer.h"
#include "rs_entity.h"
#include "rs_flags.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_image.h"
#include "rs_insert.h"
#include "rs_layer.h"
#include "rs_vector.h"
/* Global root functions */
-RS_Graphic* currentGraphic() { return RS_PYTHON->getGraphic(); }
+Drawing* currentGraphic() { return RS_PYTHON->getGraphic(); }
/* more to be added later (access to global properties, all documents,
creation of new documents, ... */
void fname(container& cont, std::auto_ptr<entity> obj) \
{ cont.addfunc(obj.get()); obj.release(); }
-TRANSFER_OWNERSHIP_FUNCTION(RS_Graphic_addLayer, RS_Graphic, addLayer, RS_Layer)
+TRANSFER_OWNERSHIP_FUNCTION(Drawing_addLayer, Drawing, addLayer, RS_Layer)
TRANSFER_OWNERSHIP_FUNCTION(RS_LayerList_add, RS_LayerList, add, RS_Layer)
#define ADDVERTEX_FUNCTION(fname, entity) \
void (RS_LayerList::*RS_LayerList_activate_layer)(RS_Layer*) = &RS_LayerList::activate;
void (RS_LayerList::*RS_LayerList_toggle_string)(const QString&) = &RS_LayerList::toggle;
void (RS_LayerList::*RS_LayerList_toggle_layer)(const QString&) = &RS_LayerList::toggle;
-void (RS_Graphic::*RS_Graphic_toggleLayer_string)(const QString&) = &RS_Graphic::toggleLayer;
-void (RS_Graphic::*RS_Graphic_toggleLayer_layer)(RS_Layer*) = &RS_Graphic::toggleLayer;
+void (Drawing::*Drawing_toggleLayer_string)(const QString&) = &Drawing::toggleLayer;
+void (Drawing::*Drawing_toggleLayer_layer)(RS_Layer*) = &Drawing::toggleLayer;
void (RS_Entity::*RS_Entity_setLayer_string)(const QString&) = &RS_Entity::setLayer;
void (RS_Entity::*RS_Entity_setLayer_layer)(RS_Layer*) = &RS_Entity::setLayer;
.add_property("filename", &RS_Document::getFilename)
;
- class_<RS_Graphic, bases<RS_Document> >("Graphic", init<RS_EntityContainer*>())
- .def("count", &RS_Graphic::count)
- .def("findLayer", &RS_Graphic::findLayer, return_value_policy<reference_existing_object>())
- .def("editLayer", &RS_Graphic::editLayer)
- .def("addLayer", RS_Graphic_addLayer)
- .def("removeLayer", &RS_Graphic::removeLayer)
- .def("toggleLayer", RS_Graphic_toggleLayer_string)
- .def("toggleLayer", RS_Graphic_toggleLayer_layer)
- .def("clearLayers", &RS_Graphic::clearLayers)
- .def("freezeAllLayers", &RS_Graphic::freezeAllLayers)
+ class_<Drawing, bases<RS_Document> >("Graphic", init<RS_EntityContainer*>())
+ .def("count", &Drawing::count)
+ .def("findLayer", &Drawing::findLayer, return_value_policy<reference_existing_object>())
+ .def("editLayer", &Drawing::editLayer)
+ .def("addLayer", Drawing_addLayer)
+ .def("removeLayer", &Drawing::removeLayer)
+ .def("toggleLayer", Drawing_toggleLayer_string)
+ .def("toggleLayer", Drawing_toggleLayer_layer)
+ .def("clearLayers", &Drawing::clearLayers)
+ .def("freezeAllLayers", &Drawing::freezeAllLayers)
;
/* Entity types */
-/****************************************************************************
-** $Id: rs_script.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_script.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_script.h"
-/****************************************************************************
-** $Id: rs_script.h 1960 2005-03-12 12:22:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SCRIPT_H
#define RS_SCRIPT_H
-/****************************************************************************
-** $Id: rs_scriptlist.cpp 1960 2005-03-12 12:22:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_scriptlist.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_scriptlist.h"
-/****************************************************************************
-** $Id: rs_scriptlist.h 1960 2005-03-12 12:22:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SCRIPTLIST_H
#define RS_SCRIPTLIST_H
+// rs_selection.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_selection.h"
#include "rs_information.h"
#include "rs_polyline.h"
#include "rs_entity.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* Default constructor.
*
* @param container The container to which we will add
- * entities. Usually that's an RS_Graphic entity but
+ * entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
RS_Selection::RS_Selection(RS_EntityContainer & container, RS_GraphicView * graphicView)
graphicView->redraw();
}
+void RS_Selection::deselectAll()
+{
+ selectAll(false);
+}
+
/**
* Selects all entities on visible layers.
*/
graphicView->redraw();
}
+void RS_Selection::deselectWindow(const Vector & v1, const Vector & v2)
+{
+ selectWindow(v1, v2, false);
+}
+
/**
* Selects all entities that are intersected by the given line.
*
}
}
+void RS_Selection::deselectIntersected(const Vector & v1, const Vector & v2)
+{
+ selectIntersected(v1, v2, false);
+}
+
/**
* Selects all entities that are connected to the given entity.
*
}
}
}
+
+void RS_Selection::deselectLayer(QString & layerName)
+{
+ selectLayer(layerName, false);
+}
-/****************************************************************************
-** $Id: rs_selection.h 1868 2004-04-05 23:12:06Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SELECTION_H
#define RS_SELECTION_H
#include "rs_entitycontainer.h"
#include "rs_graphicview.h"
-
-
/**
- * API Class for selecting entities.
+ * API Class for selecting entities.
* There's no interaction handled in this class.
* This class is connected to an entity container and
* can be connected to a graphic view.
*
* @author Andrew Mustun
*/
-class RS_Selection {
-public:
- RS_Selection(RS_EntityContainer& entityContainer,
- RS_GraphicView* graphicView=NULL);
-
- void selectSingle(RS_Entity* e);
- void selectAll(bool select=true);
- void deselectAll() {
- selectAll(false);
- }
- void invertSelection();
- void selectWindow(const Vector& v1, const Vector& v2,
- bool select=true, bool cross=false);
- void deselectWindow(const Vector& v1, const Vector& v2) {
- selectWindow(v1, v2, false);
- }
- void selectIntersected(const Vector& v1, const Vector& v2,
- bool select=true);
- void deselectIntersected(const Vector& v1, const Vector& v2) {
- selectIntersected(v1, v2, false);
- }
- void selectContour(RS_Entity* e);
-
- void selectLayer(RS_Entity* e);
- void selectLayer(const QString& layerName, bool select=true);
- void deselectLayer(QString& layerName) {
- selectLayer(layerName, false);
- }
-
-protected:
- RS_EntityContainer* container;
- RS_Graphic* graphic;
- RS_GraphicView* graphicView;
+class RS_Selection
+{
+ public:
+ RS_Selection(RS_EntityContainer & entityContainer,
+ RS_GraphicView * graphicView = NULL);
+
+ void selectSingle(RS_Entity * e);
+ void selectAll(bool select = true);
+ void deselectAll();
+ void invertSelection();
+ void selectWindow(const Vector & v1, const Vector & v2,
+ bool select = true, bool cross = false);
+ void deselectWindow(const Vector & v1, const Vector & v2);
+ void selectIntersected(const Vector & v1, const Vector & v2,
+ bool select = true);
+ void deselectIntersected(const Vector & v1, const Vector & v2);
+ void selectContour(RS_Entity * e);
+ void selectLayer(RS_Entity * e);
+ void selectLayer(const QString & layerName, bool select = true);
+ void deselectLayer(QString & layerName);
+
+ protected:
+ RS_EntityContainer * container;
+ Drawing * graphic;
+ RS_GraphicView * graphicView;
};
#endif
-/****************************************************************************
-** $Id: rs_simplepython.cpp 1775 2003-11-02 12:20:46Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
+// rs_simplepython.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#ifdef RS_OPT_SIMPLEPYTHON
#include "rs_simplepython.h"
/**
- * A test method exposed to Python
+ * A test method exposed to Python
*/
long inc(long i) {
printf("c: inc called\n");
//printf("c: addLine called\n");
//printf("c: parameter from python: %f\n", x1);
- RS_Graphic* graphic = RS_SIMPLEPYTHON->getGraphic();
+ Drawing* graphic = RS_SIMPLEPYTHON->getGraphic();
if (graphic!=NULL) {
graphic->addEntity(new RS_Line(graphic,
RS_LineData(RS_Vector(x1, y1),
-/****************************************************************************
-** $Id: rs_simplepython.h 1960 2005-03-12 12:22:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SIMPLEPYTHON_H
#define RS_SIMPLEPYTHON_H
#include "Python.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#define RS_SIMPLEPYTHON RS_SimplePython::instance()
*
* @author Andrew Mustun
*/
-class RS_SimplePython {
-private:
- RS_SimplePython() {
- graphic = NULL;
- }
+class RS_SimplePython
+{
+ private:
+ RS_SimplePython()
+ {
+ graphic = NULL;
+ }
-public:
- static RS_SimplePython* instance();
+ public:
+ static RS_SimplePython * instance();
- void setGraphic(RS_Graphic* g) {
- graphic = g;
- }
+ void setGraphic(Drawing* g)
+ {
+ graphic = g;
+ }
- RS_Graphic* getGraphic() {
- return graphic;
- }
+ Drawing * getGraphic()
+ {
+ return graphic;
+ }
- int launch(const QString& script);
+ int launch(const QString& script);
-private:
- static RS_SimplePython* uniqueInstance;
+ private:
+ static RS_SimplePython * uniqueInstance;
- RS_Graphic* graphic;
+ Drawing * graphic;
};
-
-
/**
* Global method needed by the python lib for initialisation.
*/
// rs_snapper.cpp
//
+// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
// (C) 2010 Underground Software
#include "rs_dialogfactory.h"
#include "rs_entitycontainer.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_graphicview.h"
#include "rs_grid.h"
#include "rs_information.h"
-/****************************************************************************
-** $Id: rs_solid.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_solid.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_solid.h"
#include "rs_graphicview.h"
-//#include "rs_painter.h"
#include "paintintf.h"
/**
* Default constructor.
*/
-RS_Solid::RS_Solid(RS_EntityContainer* parent,
- const RS_SolidData& d)
- :RS_AtomicEntity(parent), data(d) {
- calculateBorders();
+RS_Solid::RS_Solid(RS_EntityContainer * parent, const RS_SolidData& d):
+ RS_AtomicEntity(parent), data(d)
+{
+ calculateBorders();
}
-
-
/**
* @return Corner number 'num'.
*/
-Vector RS_Solid::getCorner(int num) {
- if (num>=0 && num<4) {
- return data.corner[num];
- } else {
- RS_DEBUG->print("Illegal corner requested from Solid",
- RS_Debug::D_WARNING);
- return Vector(false);
- }
+Vector RS_Solid::getCorner(int num)
+{
+ if (num >= 0 && num < 4)
+ {
+ return data.corner[num];
+ }
+ else
+ {
+ RS_DEBUG->print("Illegal corner requested from Solid", RS_Debug::D_WARNING);
+ return Vector(false);
+ }
}
-
-
/**
* Shapes this Solid into a standard arrow (used in dimensions).
*
* @param angle Direction of the arrow.
* @param arrowSize Size of arrow (length).
*/
-void RS_Solid::shapeArrow(const Vector& point,
- double angle,
- double arrowSize) {
-
- double cosv1, sinv1, cosv2, sinv2;
- double arrowSide = arrowSize/cos(0.165);
+void RS_Solid::shapeArrow(const Vector & point, double angle, double arrowSize)
+{
+ double cosv1, sinv1, cosv2, sinv2;
+ double arrowSide = arrowSize/cos(0.165);
- cosv1 = cos(angle+0.165)*arrowSide;
- sinv1 = sin(angle+0.165)*arrowSide;
- cosv2 = cos(angle-0.165)*arrowSide;
- sinv2 = sin(angle-0.165)*arrowSide;
+ cosv1 = cos(angle+0.165)*arrowSide;
+ sinv1 = sin(angle+0.165)*arrowSide;
+ cosv2 = cos(angle-0.165)*arrowSide;
+ sinv2 = sin(angle-0.165)*arrowSide;
- data.corner[0] = point;
- data.corner[1] = Vector(point.x - cosv1, point.y - sinv1);
- data.corner[2] = Vector(point.x - cosv2, point.y - sinv2);
- data.corner[3] = Vector(false);
+ data.corner[0] = point;
+ data.corner[1] = Vector(point.x - cosv1, point.y - sinv1);
+ data.corner[2] = Vector(point.x - cosv2, point.y - sinv2);
+ data.corner[3] = Vector(false);
- calculateBorders();
+ calculateBorders();
}
+void RS_Solid::calculateBorders()
+{
+ resetBorders();
-
-void RS_Solid::calculateBorders() {
- resetBorders();
-
- for (int i=0; i<4; ++i) {
- if (data.corner[i].valid) {
- minV = Vector::minimum(minV, data.corner[i]);
- maxV = Vector::maximum(maxV, data.corner[i]);
- }
- }
+ for(int i=0; i<4; ++i)
+ {
+ if (data.corner[i].valid)
+ {
+ minV = Vector::minimum(minV, data.corner[i]);
+ maxV = Vector::maximum(maxV, data.corner[i]);
+ }
+ }
}
+Vector RS_Solid::getNearestEndpoint(const Vector & coord, double * dist)
+{
+ double minDist = RS_MAXDOUBLE;
+ double curDist;
+ Vector ret;
+ for (int i=0; i<4; ++i)
+ {
+ if (data.corner[i].valid)
+ {
+ curDist = data.corner[i].distanceTo(coord);
-Vector RS_Solid::getNearestEndpoint(const Vector& coord, double* dist) {
-
- double minDist = RS_MAXDOUBLE;
- double curDist;
- Vector ret;
-
- for (int i=0; i<4; ++i) {
- if (data.corner[i].valid) {
- curDist = data.corner[i].distanceTo(coord);
- if (curDist<minDist) {
- ret = data.corner[i];
- minDist = curDist;
- }
- }
- }
+ if (curDist < minDist)
+ {
+ ret = data.corner[i];
+ minDist = curDist;
+ }
+ }
+ }
- if (dist!=NULL) {
- *dist = minDist;
- }
+ if (dist != NULL)
+ *dist = minDist;
- return ret;
+ return ret;
}
-
-
/**
* @todo Implement this.
*/
-Vector RS_Solid::getNearestPointOnEntity(const Vector& /*coord*/,
- bool /*onEntity*/, double* /*dist*/, RS_Entity** /*entity*/) {
-
- Vector ret(false);
- return ret;
+Vector RS_Solid::getNearestPointOnEntity(const Vector & /*coord*/,
+ bool /*onEntity*/, double * /*dist*/, RS_Entity ** /*entity*/)
+{
+ Vector ret(false);
+ return ret;
}
+Vector RS_Solid::getNearestCenter(const Vector & /*coord*/, double * dist)
+{
+ if (dist != NULL)
+ *dist = RS_MAXDOUBLE;
+ return Vector(false);
+}
-Vector RS_Solid::getNearestCenter(const Vector& /*coord*/,
- double* dist) {
-
- if (dist!=NULL) {
+Vector RS_Solid::getNearestMiddle(const Vector & /*coord*/, double * dist)
+{
+ if (dist != NULL)
*dist = RS_MAXDOUBLE;
- }
- return Vector(false);
+ return Vector(false);
}
-
-
-Vector RS_Solid::getNearestMiddle(const Vector& /*coord*/,
- double* dist) {
- if (dist!=NULL) {
+Vector RS_Solid::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+{
+ if (dist != NULL)
*dist = RS_MAXDOUBLE;
- }
- return Vector(false);
-}
-
-
-Vector RS_Solid::getNearestDist(double /*distance*/,
- const Vector& /*coord*/,
- double* dist) {
- if (dist!=NULL) {
- *dist = RS_MAXDOUBLE;
- }
- return Vector(false);
+ return Vector(false);
}
-
-
/**
* @return Distance from one of the boundry lines of this solid to given point.
*
* @todo implement
*/
-double RS_Solid::getDistanceToPoint(const Vector& /*coord*/,
- RS_Entity** /*entity*/,
- RS2::ResolveLevel /*level*/,
- double /*solidDist*/) {
- return RS_MAXDOUBLE;
+double RS_Solid::getDistanceToPoint(const Vector & /*coord*/, RS_Entity ** /*entity*/,
+ RS2::ResolveLevel /*level*/, double /*solidDist*/)
+{
+ return RS_MAXDOUBLE;
}
+void RS_Solid::move(Vector offset)
+{
+ for(int i=0; i<4; ++i)
+ data.corner[i].move(offset);
-
-void RS_Solid::move(Vector offset) {
- for (int i=0; i<4; ++i) {
- data.corner[i].move(offset);
- }
- calculateBorders();
+ calculateBorders();
}
+void RS_Solid::rotate(Vector center, double angle)
+{
+ for(int i=0; i<4; ++i)
+ data.corner[i].rotate(center, angle);
-
-void RS_Solid::rotate(Vector center, double angle) {
- for (int i=0; i<4; ++i) {
- data.corner[i].rotate(center, angle);
- }
- calculateBorders();
+ calculateBorders();
}
+void RS_Solid::scale(Vector center, Vector factor)
+{
+ for(int i=0; i<4; ++i)
+ data.corner[i].scale(center, factor);
-
-void RS_Solid::scale(Vector center, Vector factor) {
- for (int i=0; i<4; ++i) {
- data.corner[i].scale(center, factor);
- }
- calculateBorders();
+ calculateBorders();
}
+void RS_Solid::mirror(Vector axisPoint1, Vector axisPoint2)
+{
+ for(int i=0; i<4; ++i)
+ data.corner[i].mirror(axisPoint1, axisPoint2);
-
-void RS_Solid::mirror(Vector axisPoint1, Vector axisPoint2) {
- for (int i=0; i<4; ++i) {
- data.corner[i].mirror(axisPoint1, axisPoint2);
- }
- calculateBorders();
+ calculateBorders();
}
//void RS_Solid::draw(RS_Painter* painter, RS_GraphicView* view, double /*patternOffset*/)
-/****************************************************************************
-** $Id: rs_solid.h 2371 2005-04-29 11:44:39Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SOLID_H
#define RS_SOLID_H
-/****************************************************************************
-** $Id: rs_spline.cpp 2367 2005-04-04 16:57:36Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_spline.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_spline.h"
#include "rs_debug.h"
#include "rs_graphicview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "paintintf.h"
/**
-/****************************************************************************
-** $Id: rs_spline.h 1914 2004-09-19 11:05:34Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_SPLINE_H
#define RS_SPLINE_H
-/*****************************************************************************
-** $Id: rs_staticgraphicview.cpp 1686 2003-08-25 22:50:31Z andrew $
-**
-** This is part of the QCad Qt GUI
-** Copyright (C) 2001 Andrew Mustun
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License (version 2) as
-** published by the Free Software Foundation.
-**
-** This program 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 General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-******************************************************************************/
+// rs_staticgraphicview.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_staticgraphicview.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* Constructor.
-/*****************************************************************************
-** $Id: rs_staticgraphicview.h 1686 2003-08-25 22:50:31Z andrew $
-**
-** This is part of the QCad Qt GUI
-** Copyright (C) 2001 Andrew Mustun
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License (version 2) as
-** published by the Free Software Foundation.
-**
-** This program 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 General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-******************************************************************************/
-
#ifndef RS_STATICGRAPHICVIEW_H
#define RS_STATICGRAPHICVIEW_H
*/
RS_Text::RS_Text(RS_EntityContainer * parent, const RS_TextData & d): RS_EntityContainer(parent), data(d)
{
- usedTextHeight = 0.0;
- usedTextWidth = 0.0;
- setText(data.text);
+ usedTextHeight = 0.0;
+ usedTextWidth = 0.0;
+ setText(data.text);
}
/*virtual*/ RS_Text::~RS_Text()
*/
int RS_Text::getNumberOfLines()
{
- int c=1;
+ int c = 1;
- for (int i=0; i<(int)data.text.length(); ++i) {
- if (data.text.at(i).unicode()==0x0A) {
- c++;
- }
- }
+ for(int i=0; i<(int)data.text.length(); ++i)
+ {
+ if (data.text.at(i).unicode() == 0x0A)
+ {
+ c++;
+ }
+ }
- return c;
+ return c;
}
/**
*/
void RS_Text::update()
{
- RS_DEBUG->print("RS_Text::update");
-
- clear();
-
- if (isUndone()) {
- return;
- }
-
- usedTextWidth = 0.0;
- usedTextHeight = 0.0;
-
- RS_Font* font = RS_FONTLIST->requestFont(data.style);
-
- if (font==NULL) {
- return;
- }
-
- Vector letterPos = Vector(0.0, -9.0);
- Vector letterSpace = Vector(font->getLetterSpacing(), 0.0);
- Vector space = Vector(font->getWordSpacing(), 0.0);
- int lineCounter = 0;
-
- // Every single text line gets stored in this entity container
- // so we can move the whole line around easely:
- RS_EntityContainer* oneLine = new RS_EntityContainer(this);
-
- // First every text line is created with
- // alignement: top left
- // angle: 0
- // height: 9.0
- // Rotation, scaling and centering is done later
-
- // For every letter:
- for (int i=0; i<(int)data.text.length(); ++i) {
- switch (data.text.at(i).unicode()) {
- case 0x0A:
- // line feed:
- updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
- letterPos = Vector(0.0, -9.0);
- break;
-
- case 0x20:
- // Space:
- letterPos+=space;
- break;
-
- case 0x5C: {
- // code (e.g. \S, \P, ..)
- i++;
- int ch = data.text.at(i).unicode();
- switch (ch) {
- case 'P':
- updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
- letterPos = Vector(0.0, -9.0);
- break;
-
- case 'S': {
- QString up;
- QString dw;
- //letterPos += letterSpace;
-
- // get upper string:
- i++;
- while (data.text.at(i).unicode()!='^' &&
- //data.text.at(i).unicode()!='/' &&
- data.text.at(i).unicode()!='\\' &&
- //data.text.at(i).unicode()!='#' &&
- i<(int)data.text.length()) {
- up += data.text.at(i);
- i++;
- }
-
- i++;
-
- if (data.text.at(i-1).unicode()=='^' &&
- data.text.at(i).unicode()==' ') {
- i++;
- }
-
- // get lower string:
- while (data.text.at(i).unicode()!=';' &&
- i<(int)data.text.length()) {
- dw += data.text.at(i);
- i++;
- }
-
- // add texts:
- RS_Text* upper =
- new RS_Text(
- oneLine,
- RS_TextData(letterPos + Vector(0.0,9.0),
- 4.0, 100.0, RS2::VAlignTop,
- RS2::HAlignLeft,
- RS2::LeftToRight, RS2::Exact,
- 1.0, up, data.style,
- 0.0, RS2::Update));
- upper->setLayer(NULL);
- upper->setPen(RS_Pen(RS2::FlagInvalid));
- oneLine->addEntity(upper);
-
- RS_Text* lower =
- new RS_Text(
- oneLine,
- RS_TextData(letterPos+Vector(0.0,4.0),
- 4.0, 100.0, RS2::VAlignTop,
- RS2::HAlignLeft,
- RS2::LeftToRight, RS2::Exact,
- 1.0, dw, data.style,
- 0.0, RS2::Update));
- lower->setLayer(NULL);
- lower->setPen(RS_Pen(RS2::FlagInvalid));
- oneLine->addEntity(lower);
-
- // move cursor:
- upper->calculateBorders();
- lower->calculateBorders();
-
- double w1 = upper->getSize().x;
- double w2 = lower->getSize().x;
-
- if (w1>w2) {
- letterPos += Vector(w1, 0.0);
- } else {
- letterPos += Vector(w2, 0.0);
- }
- letterPos += letterSpace;
- }
- break;
-
- default:
- break;
- }
- }
- break;
-
- default: {
- // One Letter:
- if (font->findLetter(QString(data.text.at(i))) != NULL) {
-
- RS_DEBUG->print("RS_Text::update: insert a "
- "letter at pos: %f/%f", letterPos.x, letterPos.y);
-
- RS_InsertData d(QString(data.text.at(i)),
- letterPos,
- Vector(1.0, 1.0),
- 0.0,
- 1,1, Vector(0.0,0.0),
- font->getLetterList(), RS2::NoUpdate);
-
- RS_Insert* letter = new RS_Insert(this, d);
- Vector letterWidth;
- letter->setPen(RS_Pen(RS2::FlagInvalid));
- letter->setLayer(NULL);
- letter->update();
- letter->forcedCalculateBorders();
-
- // until 2.0.4.5:
- //letterWidth = Vector(letter->getSize().x, 0.0);
- // from 2.0.4.6:
- letterWidth = Vector(letter->getMax().x-letterPos.x, 0.0);
-
- oneLine->addEntity(letter);
-
- // next letter position:
- letterPos += letterWidth;
- letterPos += letterSpace;
- }
- }
- break;
- }
- }
-
- updateAddLine(oneLine, lineCounter);
- usedTextHeight -= data.height*data.lineSpacingFactor*1.6
- - data.height;
- forcedCalculateBorders();
-
- RS_DEBUG->print("RS_Text::update: OK");
+ RS_DEBUG->print("RS_Text::update");
+
+ clear();
+
+ if (isUndone())
+ return;
+
+ usedTextWidth = 0.0;
+ usedTextHeight = 0.0;
+
+ RS_Font * font = RS_FONTLIST->requestFont(data.style);
+
+ if (font == NULL)
+ return;
+
+ Vector letterPos = Vector(0.0, -9.0);
+ Vector letterSpace = Vector(font->getLetterSpacing(), 0.0);
+ Vector space = Vector(font->getWordSpacing(), 0.0);
+ int lineCounter = 0;
+
+ // Every single text line gets stored in this entity container
+ // so we can move the whole line around easely:
+ RS_EntityContainer * oneLine = new RS_EntityContainer(this);
+
+ // First every text line is created with
+ // alignement: top left
+ // angle: 0
+ // height: 9.0
+ // Rotation, scaling and centering is done later
+
+ // For every letter:
+ for(int i=0; i<(int)data.text.length(); ++i)
+ {
+ switch (data.text.at(i).unicode())
+ {
+ case 0x0A:
+ // line feed:
+ updateAddLine(oneLine, lineCounter++);
+ oneLine = new RS_EntityContainer(this);
+ letterPos = Vector(0.0, -9.0);
+ break;
+
+ case 0x20:
+ // Space:
+ letterPos += space;
+ break;
+
+ case 0x5C:
+ {
+ // code (e.g. \S, \P, ..)
+ i++;
+ int ch = data.text.at(i).unicode();
+
+ switch (ch)
+ {
+ case 'P':
+ updateAddLine(oneLine, lineCounter++);
+ oneLine = new RS_EntityContainer(this);
+ letterPos = Vector(0.0, -9.0);
+ break;
+
+ case 'S':
+ {
+ QString up;
+ QString dw;
+ //letterPos += letterSpace;
+
+ // get upper string:
+ i++;
+ while (data.text.at(i).unicode() != '^'
+ && data.text.at(i).unicode() != '\\'
+ && i < (int)data.text.length())
+ {
+ up += data.text.at(i);
+ i++;
+ }
+
+ i++;
+
+ if (data.text.at(i - 1).unicode() == '^'
+ && data.text.at(i).unicode() == ' ')
+ {
+ i++;
+ }
+
+ // get lower string:
+ while (data.text.at(i).unicode() != ';' && i < (int)data.text.length())
+ {
+ dw += data.text.at(i);
+ i++;
+ }
+
+ // add texts:
+ RS_Text * upper = new RS_Text(oneLine,
+ RS_TextData(letterPos + Vector(0.0, 9.0),
+ 4.0, 100.0, RS2::VAlignTop,
+ RS2::HAlignLeft,
+ RS2::LeftToRight, RS2::Exact,
+ 1.0, up, data.style,
+ 0.0, RS2::Update));
+ upper->setLayer(NULL);
+ upper->setPen(RS_Pen(RS2::FlagInvalid));
+ oneLine->addEntity(upper);
+
+ RS_Text * lower = new RS_Text(oneLine,
+ RS_TextData(letterPos+Vector(0.0, 4.0),
+ 4.0, 100.0, RS2::VAlignTop,
+ RS2::HAlignLeft,
+ RS2::LeftToRight, RS2::Exact,
+ 1.0, dw, data.style,
+ 0.0, RS2::Update));
+ lower->setLayer(NULL);
+ lower->setPen(RS_Pen(RS2::FlagInvalid));
+ oneLine->addEntity(lower);
+
+ // move cursor:
+ upper->calculateBorders();
+ lower->calculateBorders();
+
+ double w1 = upper->getSize().x;
+ double w2 = lower->getSize().x;
+
+ if (w1 > w2)
+ letterPos += Vector(w1, 0.0);
+ else
+ letterPos += Vector(w2, 0.0);
+
+ letterPos += letterSpace;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ default:
+ {
+ // One Letter:
+ if (font->findLetter(QString(data.text.at(i))) != NULL)
+ {
+ RS_DEBUG->print("RS_Text::update: insert a "
+ "letter at pos: %f/%f", letterPos.x, letterPos.y);
+
+ RS_InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
+ 0.0, 1,1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate);
+
+ RS_Insert * letter = new RS_Insert(this, d);
+ letter->setPen(RS_Pen(RS2::FlagInvalid));
+ letter->setLayer(NULL);
+ letter->update();
+ letter->forcedCalculateBorders();
+
+ // until 2.0.4.5:
+ //letterWidth = Vector(letter->getSize().x, 0.0);
+ // from 2.0.4.6:
+ Vector letterWidth = Vector(letter->getMax().x - letterPos.x, 0.0);
+
+ oneLine->addEntity(letter);
+
+ // next letter position:
+ letterPos += letterWidth;
+ letterPos += letterSpace;
+ }
+ }
+ break;
+ }
+ }
+
+ updateAddLine(oneLine, lineCounter);
+ usedTextHeight -= data.height * data.lineSpacingFactor * 1.6 - data.height;
+ forcedCalculateBorders();
+
+ RS_DEBUG->print("RS_Text::update: OK");
}
/**
*/
void RS_Text::updateAddLine(RS_EntityContainer* textLine, int lineCounter)
{
- RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x);
+ RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x);
//textLine->forcedCalculateBorders();
- //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x);
+ //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x);
- // Move to correct line position:
- textLine->move(Vector(0.0, -9.0 * lineCounter
- * data.lineSpacingFactor * 1.6));
+ // Move to correct line position:
+ textLine->move(Vector(0.0, -9.0 * lineCounter * data.lineSpacingFactor * 1.6));
textLine->forcedCalculateBorders();
Vector textSize = textLine->getSize();
RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textSize.x);
- // Horizontal Align:
- switch (data.halign) {
- case RS2::HAlignCenter:
- RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x/2.0);
- textLine->move(Vector(-textSize.x/2.0, 0.0));
- break;
+ // Horizontal Align:
+ switch (data.halign)
+ {
+ case RS2::HAlignCenter:
+ RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x / 2.0);
+ textLine->move(Vector(-textSize.x / 2.0, 0.0));
+ break;
- case RS2::HAlignRight:
- textLine->move(Vector(-textSize.x, 0.0));
- break;
+ case RS2::HAlignRight:
+ textLine->move(Vector(-textSize.x, 0.0));
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- // Vertical Align:
- double vSize = getNumberOfLines()*9.0*data.lineSpacingFactor*1.6
- - (9.0*data.lineSpacingFactor*1.6 - 9.0);
+ // Vertical Align:
+ double vSize = getNumberOfLines() * 9.0 * data.lineSpacingFactor * 1.6 - (9.0 * data.lineSpacingFactor * 1.6 - 9.0);
- switch (data.valign) {
- case RS2::VAlignMiddle:
- textLine->move(Vector(0.0, vSize/2.0));
- break;
+ switch (data.valign)
+ {
+ case RS2::VAlignMiddle:
+ textLine->move(Vector(0.0, vSize / 2.0));
+ break;
- case RS2::VAlignBottom:
- textLine->move(Vector(0.0, vSize));
- break;
+ case RS2::VAlignBottom:
+ textLine->move(Vector(0.0, vSize));
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- // Scale:
- textLine->scale(Vector(0.0,0.0),
- Vector(data.height/9.0, data.height/9.0));
+ // Scale:
+ textLine->scale(Vector(0.0, 0.0), Vector(data.height / 9.0, data.height / 9.0));
- textLine->forcedCalculateBorders();
+ textLine->forcedCalculateBorders();
- // Update actual text size (before rotating, after scaling!):
- if (textLine->getSize().x>usedTextWidth) {
- usedTextWidth = textLine->getSize().x;
- }
+ // Update actual text size (before rotating, after scaling!):
+ if (textLine->getSize().x > usedTextWidth)
+ usedTextWidth = textLine->getSize().x;
- usedTextHeight += data.height*data.lineSpacingFactor*1.6;
+ usedTextHeight += data.height * data.lineSpacingFactor * 1.6;
- // Rotate:
- textLine->rotate(Vector(0.0,0.0), data.angle);
+ // Rotate:
+ textLine->rotate(Vector(0.0, 0.0), data.angle);
- // Move:
- textLine->move(data.insertionPoint);
- textLine->setPen(RS_Pen(RS2::FlagInvalid));
- textLine->setLayer(NULL);
- textLine->forcedCalculateBorders();
+ // Move:
+ textLine->move(data.insertionPoint);
+ textLine->setPen(RS_Pen(RS2::FlagInvalid));
+ textLine->setLayer(NULL);
+ textLine->forcedCalculateBorders();
- addEntity(textLine);
+ addEntity(textLine);
}
Vector RS_Text::getInsertionPoint()
void RS_Text::move(Vector offset)
{
- data.insertionPoint.move(offset);
- update();
+ data.insertionPoint.move(offset);
+ update();
}
void RS_Text::rotate(Vector center, double angle)
{
- data.insertionPoint.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle+angle);
- update();
+ data.insertionPoint.rotate(center, angle);
+ data.angle = RS_Math::correctAngle(data.angle + angle);
+ update();
}
void RS_Text::scale(Vector center, Vector factor)
{
- data.insertionPoint.scale(center, factor);
- data.width*=factor.x;
- data.height*=factor.x;
- update();
+ data.insertionPoint.scale(center, factor);
+ data.width *= factor.x;
+ data.height *= factor.x;
+ update();
}
void RS_Text::mirror(Vector axisPoint1, Vector axisPoint2)
{
- data.insertionPoint.mirror(axisPoint1, axisPoint2);
- //double ang = axisPoint1.angleTo(axisPoint2);
- bool readable = RS_Math::isAngleReadable(data.angle);
-
- Vector vec;
- vec.setPolar(1.0, data.angle);
- vec.mirror(Vector(0.0,0.0), axisPoint2-axisPoint1);
- data.angle = vec.angle();
-
- bool corr;
- data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr);
-
- if (corr) {
- if (data.halign==RS2::HAlignLeft) {
- data.halign=RS2::HAlignRight;
- } else if (data.halign==RS2::HAlignRight) {
- data.halign=RS2::HAlignLeft;
- }
- } else {
- if (data.valign==RS2::VAlignTop) {
- data.valign=RS2::VAlignBottom;
- } else if (data.valign==RS2::VAlignBottom) {
- data.valign=RS2::VAlignTop;
- }
- }
- update();
+ data.insertionPoint.mirror(axisPoint1, axisPoint2);
+ //double ang = axisPoint1.angleTo(axisPoint2);
+ bool readable = RS_Math::isAngleReadable(data.angle);
+
+ Vector vec;
+ vec.setPolar(1.0, data.angle);
+ vec.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1);
+ data.angle = vec.angle();
+
+ bool corr;
+ data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr);
+
+ if (corr)
+ {
+ if (data.halign == RS2::HAlignLeft)
+ {
+ data.halign = RS2::HAlignRight;
+ }
+ else if (data.halign == RS2::HAlignRight)
+ {
+ data.halign = RS2::HAlignLeft;
+ }
+ }
+ else
+ {
+ if (data.valign == RS2::VAlignTop)
+ {
+ data.valign = RS2::VAlignBottom;
+ }
+ else if (data.valign == RS2::VAlignBottom)
+ {
+ data.valign = RS2::VAlignTop;
+ }
+ }
+
+ update();
}
bool RS_Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
{
- return false;
+ return false;
}
-
-
/**
* Implementations must stretch the given range of the entity
* by the given offset.
*/
-void RS_Text::stretch(Vector firstCorner,
- Vector secondCorner,
- Vector offset) {
-
- if (getMin().isInWindow(firstCorner, secondCorner) &&
- getMax().isInWindow(firstCorner, secondCorner)) {
-
- move(offset);
- }
+void RS_Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+{
+ if (getMin().isInWindow(firstCorner, secondCorner)
+ && getMax().isInWindow(firstCorner, secondCorner))
+ move(offset);
}
-
-
/**
* Dumps the point's data to stdout.
*/
-std::ostream& operator << (std::ostream& os, const RS_Text& p) {
- os << " Text: " << p.getData() << "\n";
- return os;
+std::ostream & operator<<(std::ostream & os, const RS_Text & p)
+{
+ os << " Text: " << p.getData() << "\n";
+ return os;
}
-
+// rs_undo.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_undo.h"
-/****************************************************************************
-** $Id: rs_undo.h 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_UNDO_H
#define RS_UNDO_H
-/****************************************************************************
-** $Id: rs_undoable.cpp 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_undoable.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/02/2010 Added this text. :-)
+//
#include "rs_undoable.h"
-// undocycle.h
+// rs_undocycle.cpp
//
+// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
// (C) 2010 Underground Software
-/****************************************************************************
-** $Id: rs_units.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_units.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 05/05/2010 Moved implementation from header to this file. :-)
+//
#include "rs_units.h"
-/****************************************************************************
-** $Id: rs_units.h 1877 2004-05-15 09:09:21Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_UNITS_H
#define RS_UNITS_H
-/****************************************************************************
-** $Id: rs_utility.cpp 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_utility.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 05/05/2010 Moved implementation from header to this file. :-)
+//
#include "rs_utility.h"
-/****************************************************************************
-** $Id: rs_utility.h 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-
#ifndef RS_UTILITY_H
#define RS_UTILITY_H
-//#include "rs_string.h"
#include <QtCore>
/**
// rs_variable.cpp
//
+// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
// (C) 2010 Underground Software
-/****************************************************************************
-** $Id: rs_variable.h 1648 2003-06-11 06:56:01Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
#ifndef RS_VARIABLE_H
#define RS_VARIABLE_H
#include <iostream> // Needed for 'friend ostream' below
-//#include "rs.h"
-
/**
* Represents a 3d vector (x/y/z)
*
#include "coordinatewidget.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "settings.h"
#include "rs_units.h"
{
}
-void CoordinateWidget::setGraphic(RS_Graphic * graphic)
+void CoordinateWidget::setGraphic(Drawing * graphic)
{
this->graphic = graphic;
setCoordinates(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
#include "ui_coordinatewidget.h"
#include "rs.h"
-class RS_Graphic;
+class Drawing;
class Vector;
class CoordinateWidget: public QWidget
~CoordinateWidget();
public slots:
- void setGraphic(RS_Graphic * graphic);
+ void setGraphic(Drawing * graphic);
void setCoordinates(const Vector & abs, const Vector & rel, bool updateFormat);
void setCoordinates(double x, double y, double rx, double ry, bool updateFormat);
private:
- RS_Graphic * graphic;
+ Drawing * graphic;
int prec;
RS2::LinearFormat format;
int aprec;
//pen = line->getPen();
ui.wPen->setPen(data->pen, true, true, "Pen");
- //RS_Graphic* graphic = line->getGraphic();
+ //Drawing* graphic = line->getGraphic();
//if (graphic!=NULL) {
ui.cbLayer->init(layerList, false, true);
//}
#include "rs.h"
#include "rs_debug.h"
#include "rs_filterdxf.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_math.h"
#include "rs_units.h"
#include "vector.h"
/**
* Sets the graphic and updates the GUI to match the drawing.
*/
-void DlgOptionsDrawing::setGraphic(RS_Graphic * g)
+void DlgOptionsDrawing::setGraphic(Drawing * g)
{
graphic = g;
#include "ui_dlgoptionsdrawing.h"
-class RS_Graphic;
+class Drawing;
class DlgOptionsDrawing: public QDialog
{
~DlgOptionsDrawing();
public slots:
- void setGraphic(RS_Graphic * g);
+ void setGraphic(Drawing * g);
void validate();
void updateLengthPrecision();
void updateAnglePrecision();
private:
QStringList listPrec1;
- RS_Graphic * graphic;
+ Drawing * graphic;
private:
Ui::DlgOptionsDrawing ui;
#include "librarywidget.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "rs_staticgraphicview.h"
#include "rs_system.h"
#include "paintintf.h"
qpntr.eraseRect(0, 0, 128, 128);
RS_StaticGraphicView gv(128, 128, painter);
- RS_Graphic graphic;
+ Drawing graphic;
if (graphic.open(dxfPath, RS2::FormatUnknown))
{
if (machine.isEmpty() == false && input.isEmpty() == false && output.isEmpty() == false)
{
RS_FilterCAM fc;
- RS_Graphic gr;
+ Drawing gr;
RS_FILEIO->fileImport(gr, input, RS2::FormatUnknown);
RS_CamDialog dlg(gr, NULL);
dlg.activateMachineGenerator(machine);
RS_Document* d = getDocument();
if (d!=NULL) {
- RS_Graphic* graphic = (RS_Graphic*)d;
+ Drawing* graphic = (Drawing*)d;
RS_CamDialog dlg(graphic, this);
dlg.exec();
// only graphics offer block lists, blocks don't
RS_DEBUG->print(" adding listeners");
- RS_Graphic * graphic = w->getDocument()->getGraphic();
+ Drawing * graphic = w->getDocument()->getGraphic();
if (graphic != NULL)
{
return false;
}
- RS_Graphic * graphic = w->getDocument()->getGraphic();
+ Drawing * graphic = w->getDocument()->getGraphic();
if (graphic == NULL)
{
return;
}
- RS_Graphic * graphic = w->getDocument()->getGraphic();
+ Drawing * graphic = w->getDocument()->getGraphic();
if (graphic == NULL)
{
// only graphics offer block lists, blocks don't
RS_DEBUG->print(" adding listeners");
- RS_Graphic * graphic = w->getDocument()->getGraphic();
+ Drawing * graphic = w->getDocument()->getGraphic();
if (graphic != NULL)
{
if (m != NULL)
{
- RS_Graphic * g = m->getGraphic();
+ Drawing * g = m->getGraphic();
if (g != NULL)
g->setGridOn(toggle);
/*QC_MDIWindow* m = getMDIWindow();
if (m!=NULL) {
- RS_Graphic* g = m->getGraphic();
+ Drawing* g = m->getGraphic();
if (g!=NULL) {
g->setDraftOn(toggle);
}
{
RS_DEBUG->print("QC_ApplicationWindow::slotTestDrawFreehand()");
- //RS_Graphic* g = document->getMarking();
+ //Drawing* g = document->getMarking();
/*
RS_ActionDrawLineFree* action =
if (d != NULL && d->rtti() == RS2::EntityGraphic)
{
- RS_Graphic * graphic = (RS_Graphic *)d;
+ Drawing * graphic = (Drawing *)d;
if (graphic == NULL)
return;
if (d != NULL)
{
- RS_Graphic * graphic = (RS_Graphic *)d;
+ Drawing * graphic = (Drawing *)d;
if (graphic == NULL)
return;
if (d != NULL)
{
- RS_Graphic * graphic = (RS_Graphic *)d;
+ Drawing * graphic = (Drawing *)d;
if (graphic == NULL)
return;
if (d != NULL)
{
- RS_Graphic * graphic = (RS_Graphic *)d;
+ Drawing * graphic = (Drawing *)d;
if (graphic == NULL)
return;
slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF);
RS_Document* d = getDocument();
if (d!=NULL) {
- RS_Graphic* graphic = (RS_Graphic*)d;
+ Drawing* graphic = (Drawing*)d;
if (graphic==NULL) {
return;
}
RS_Document* d = getDocument();
if (d!=NULL) {
- RS_Graphic* graphic = (RS_Graphic*)d;
+ Drawing* graphic = (Drawing*)d;
if (graphic==NULL) {
return;
}
if (doc == NULL)
{
- document = new RS_Graphic();
+ document = new Drawing();
document->newDoc();
owner = true;
}
}
/** @return Pointer to graphic or NULL */
-RS_Graphic * QC_MDIWindow::getGraphic()
+Drawing * QC_MDIWindow::getGraphic()
{
return document->getGraphic();
}
public:
QC_GraphicView * getGraphicView();
RS_Document * getDocument();
- RS_Graphic * getGraphic();
+ Drawing * getGraphic();
RS_EventHandler * getEventHandler();
void addChildWindow(QC_MDIWindow * w);
#include "qg_dialogfactory.h"
+#include "qg_layerwidget.h"
+#include "qg_mainwindowinterface.h"
+#include "rs_actiondimlinear.h"
+#include "rs_actioninterface.h"
+#include "rs_document.h"
#include "rs_patternlist.h"
#include "settings.h"
#include "rs_system.h"
-#include "rs_actioninterface.h"
-#include "rs_document.h"
-#include "rs_actiondimlinear.h"
+#include "rs_text.h"
#if 0
#include "ui/qg_arcoptions.h"
#include "rs_camdialog.h"
#endif
-#include "qg_layerwidget.h"
-#include "qg_mainwindowinterface.h"
-
//QG_DialogFactory* QG_DialogFactory::uniqueInstance = NULL;
/**
return false;
}
+/**
+ * Shows a dialog to edit the given entity.
+ */
bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
{
- return false;
+ if (entity == NULL)
+ return false;
+
+ bool ret = false;
+
+ switch (entity->rtti())
+ {
+//NOTE: These #if 0's are put here until these missing dialogs can be ported to Qt4.
+#if 0
+ case RS2::EntityPoint:
+ {
+ QG_DlgPoint dlg(parent);
+ dlg.setPoint(*((RS_Point *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updatePoint();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityLine:
+ {
+ QG_DlgLine dlg(parent);
+ dlg.setLine(*((RS_Line *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateLine();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityArc:
+ {
+ QG_DlgArc dlg(parent);
+ dlg.setArc(*((RS_Arc *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateArc();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityCircle:
+ {
+ QG_DlgCircle dlg(parent);
+ dlg.setCircle(*((RS_Circle *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateCircle();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityEllipse:
+ {
+ QG_DlgEllipse dlg(parent);
+ dlg.setEllipse(*((RS_Ellipse *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateEllipse();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntitySpline:
+ {
+ QG_DlgSpline dlg(parent);
+ dlg.setSpline(*((RS_Spline *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateSpline();
+ ret = true;
+ }
+ }
+ break;
+
+ case RS2::EntityInsert:
+ {
+ QG_DlgInsert dlg(parent);
+ dlg.setInsert(*((RS_Insert *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateInsert();
+ ret = true;
+ entity->update();
+ }
+ }
+ break;
+
+ case RS2::EntityDimAligned:
+ case RS2::EntityDimAngular:
+ case RS2::EntityDimDiametric:
+ case RS2::EntityDimRadial:
+ {
+ QG_DlgDimension dlg(parent);
+ dlg.setDim(*((RS_Dimension *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateDim();
+ ret = true;
+ ((RS_Dimension *)entity)->update(true);
+ }
+ }
+ break;
+
+ case RS2::EntityDimLinear:
+ {
+ QG_DlgDimLinear dlg(parent);
+ dlg.setDim(*((RS_DimLinear *)entity));
+
+ if (dlg.exec())
+ {
+ dlg.updateDim();
+ ret = true;
+ ((RS_DimLinear *)entity)->update(true);
+ }
+ }
+ break;
+#endif
+
+ case RS2::EntityText:
+ {
+ DlgText dlg(parent);
+ dlg.setText(*((RS_Text *)entity), false);
+
+ if (dlg.exec())
+ {
+ dlg.updateText();
+ ret = true;
+ ((RS_Text *)entity)->update();
+ }
+ }
+ break;
+
+#if 0
+ case RS2::EntityHatch:
+ {
+ QG_DlgHatch dlg(parent);
+ dlg.setHatch(*((RS_Hatch *)entity), false);
+
+ if (dlg.exec())
+ {
+ dlg.updateHatch();
+ ret = true;
+ ((RS_Hatch *)entity)->update();
+ }
+ }
+ break;
+#endif
+
+ default:
+ break;
+ }
+
+ return ret;
}
/*
/**
* Shows a dialog for CAM options.
*/
-bool QG_DialogFactory::requestCamOptionsDialog(RS_Graphic& graphic)
+bool QG_DialogFactory::requestCamOptionsDialog(Drawing& graphic)
{
RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
RS_CamDialog dlg(graphic, parent);
/**
* Shows dialog for drawing options.
*/
-void QG_DialogFactory::requestOptionsDrawingDialog(RS_Graphic & graphic)
+void QG_DialogFactory::requestOptionsDrawingDialog(Drawing & graphic)
{
DlgOptionsDrawing dlg(parent);
dlg.setGraphic(&graphic);
virtual bool requestHatchDialog(RS_Hatch * hatch);
#ifdef RS_CAM
- virtual bool requestCamOptionsDialog(RS_Graphic & graphic);
+ virtual bool requestCamOptionsDialog(Drawing & graphic);
#endif
virtual void requestOptionsGeneralDialog();
- virtual void requestOptionsDrawingDialog(RS_Graphic & graphic);
+ virtual void requestOptionsDrawingDialog(Drawing & graphic);
virtual void requestPreviousMenu();
#include "qg_graphicview.h"
#include "settings.h"
#include "rs_system.h"
-#include "rs_graphic.h"
+#include "drawing.h"
/**
* Shows a dialog for choosing a file name. Saving the file is up to
fileDlg->selectNameFilter(defFilter);
// preview:
- RS_Graphic * gr = new RS_Graphic;
+ Drawing * gr = new Drawing;
QG_GraphicView * prev = new QG_GraphicView(parent);
prev->setContainer(gr);
prev->setBorders(1, 1, 1, 1);
#include "rs_actionzoomscroll.h"
#include "rs_actionmodifydelete.h"
#include "rs_actionselectsingle.h"
-#include "rs_graphic.h"
+#include "drawing.h"
#include "settings.h"
#include "rs_system.h"
#include "rs_patternlist.h"
*/
void QG_GraphicView::previewUrl(const Q3Url & u)
{
- //static RS_Graphic* gr = new RS_Graphic();
+ //static Drawing* gr = new Drawing();
RS_DEBUG->print("QG_GraphicView::previewUrl");
if (container != NULL && container->rtti() == RS2::EntityGraphic)
{
- ((RS_Graphic *)container)->open(u.path(), RS2::FormatUnknown);
+ ((Drawing *)container)->open(u.path(), RS2::FormatUnknown);
zoomAuto();
}
//setContainer(gr);