]> Shamusworld >> Repos - architektonas/blobdiff - src/base/pattern.cpp
Major refactor of Architektonas: Jettisoning old cruft.
[architektonas] / src / base / pattern.cpp
diff --git a/src/base/pattern.cpp b/src/base/pattern.cpp
deleted file mode 100644 (file)
index b1f4046..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-// pattern.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who  When        What
-// ---  ----------  -----------------------------------------------------------
-// JLH  06/01/2010  Added this text. :-)
-//
-
-#include "pattern.h"
-
-#include <QtCore>
-#include "system.h"
-#include "fileio.h"
-#include "drawing.h"
-
-/**
- * Constructor.
- *
- * @param fileName File name of a DXF file defining the pattern
- */
-Pattern::Pattern(const QString & file): EntityContainer(NULL),
-       filename(file), loaded(false)
-{
-       DEBUG->print("Pattern::Pattern() ");
-}
-
-Pattern::~Pattern()
-{
-}
-
-/**
- * Loads the given pattern file into this pattern.
- * Entities other than lines are ignored.
- *
- * @param filename File name of the pattern file (without path and
- * extension or full path.
- */
-bool Pattern::loadPattern()
-{
-       if (loaded)
-               return true;
-
-       DEBUG->print("Pattern::loadPattern");
-       QString path;
-
-       // Search for the appropriate pattern if we have only the name of the pattern:
-       if (!filename.toLower().contains(".dxf"))
-       {
-               QStringList patterns = SYSTEM->getPatternList();
-               QFileInfo file;
-
-               for(QStringList::Iterator it=patterns.begin(); it!=patterns.end(); it++)
-               {
-                       if (QFileInfo(*it).baseName().toLower() == filename.toLower())
-                       {
-                               path = *it;
-                               DEBUG->print("Pattern found: %s", path.toAscii().data());
-                               break;
-                       }
-               }
-       }
-       // We have the full path of the pattern:
-       else
-       {
-               path = filename;
-       }
-
-       // No pattern paths found:
-       if (path.isEmpty())
-       {
-               DEBUG->print("No pattern \"%s\"available.", filename.toAscii().data());
-               return false;
-       }
-
-       Drawing * drawing = new Drawing();
-
-       // TODO: Find out why the new dxf filter doesn't work for patterns:
-       FILEIO->fileImport(*drawing, path, RS2::FormatDXF1);
-
-       for(Entity * e=drawing->firstEntity(); e!=NULL; e=drawing->nextEntity())
-       {
-               if (e->rtti() == RS2::EntityLine || e->rtti() == RS2::EntityArc)
-               {
-                       Entity * clone = e->clone();
-                       clone->reparent(this);
-                       Layer * layer = e->getLayer();
-
-                       if (layer)
-                               clone->setLayer(layer->getName());
-
-                       addEntity(clone);
-               }
-       }
-
-       delete drawing;
-       loaded = true;
-       DEBUG->print("Pattern::loadPattern: OK");
-
-       return true;
-}
-
-/** @return the fileName of this pattern. */
-QString Pattern::getFileName() const
-{
-       return filename;
-}