From 3da9fc4348f18564bd4af3b1561f9cbee285d72e Mon Sep 17 00:00:00 2001 From: wonder Date: Thu, 30 Jul 2009 00:48:23 +0000 Subject: [PATCH] Removed Label class (not used anymore) git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11208 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/core/CMakeLists.txt | 1 - src/core/pal/costcalculator.cpp | 1 - src/core/pal/label.cpp | 107 ------------------ src/core/pal/label.h | 132 ----------------------- src/core/pal/labelposition.cpp | 1 - src/core/pal/pal.cpp | 1 + src/core/pal/pal.h | 3 +- src/core/pal/palgeometry.h | 24 +---- src/core/pal/problem.cpp | 1 - src/core/qgspalobjectpositionmanager.cpp | 4 +- 10 files changed, 4 insertions(+), 271 deletions(-) delete mode 100644 src/core/pal/label.cpp delete mode 100644 src/core/pal/label.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9648393ad9e5..8dda9ef89416 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -85,7 +85,6 @@ SET(QGIS_CORE_SRCS pal/costcalculator.cpp pal/feature.cpp pal/geomfunction.cpp - pal/label.cpp pal/labelposition.cpp pal/layer.cpp pal/pal.cpp diff --git a/src/core/pal/costcalculator.cpp b/src/core/pal/costcalculator.cpp index 7c49a981370b..a7a25c60cdd5 100644 --- a/src/core/pal/costcalculator.cpp +++ b/src/core/pal/costcalculator.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "feature.h" #include "geomfunction.h" diff --git a/src/core/pal/label.cpp b/src/core/pal/label.cpp deleted file mode 100644 index 696f153cf41b..000000000000 --- a/src/core/pal/label.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libpal - Automated Placement of Labels Library - * - * Copyright (C) 2008 Maxence Laurent, MIS-TIC, HEIG-VD - * University of Applied Sciences, Western Switzerland - * http://www.hes-so.ch - * - * Contact: - * maxence.laurent heig-vd ch - * or - * eric.taillard heig-vd ch - * - * This file is part of libpal. - * - * libpal is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * libpal 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 libpal. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#define _CRT_SECURE_NO_DEPRECATE - -#include - -#include -#include - -namespace pal -{ - - Label::Label( double x[4], double y[4], double alpha, const char *ftid, const char *lyrName, PalGeometry *userGeom ) : a( alpha ), userGeom( userGeom ) - { - - for ( int i = 0;i < 4;i++ ) - { - this->x[i] = x[i]; - this->y[i] = y[i]; - } - - featureId = new char[strlen( ftid ) +1]; - strcpy( featureId, ftid ); - - this->lyrName = new char[strlen( lyrName ) +1]; - strcpy( this->lyrName, lyrName ); - } - - Label::~Label() - { - delete[] featureId; - delete[] lyrName; - } - - double Label::getOrigX() - { - return x[0]; - } - - double Label::getOrigY() - { - return y[0]; - } - - double Label::getX( size_t i ) - { - return ( i < 4 ? x[i] : -1 ); - } - - double Label::getY( size_t i ) - { - return ( i < 4 ? y[i] : -1 ); - } - - PalGeometry *Label::getGeometry() - { - return userGeom; - } - - double Label::getRotation() - { - return a; - } - - const char *Label::getLayerName() - { - return lyrName; - } - - const char *Label::getFeatureId() - { - return featureId; - } - -} // end namespace - diff --git a/src/core/pal/label.h b/src/core/pal/label.h deleted file mode 100644 index 4c5a16ee8e56..000000000000 --- a/src/core/pal/label.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * libpal - Automated Placement of Labels Library - * - * Copyright (C) 2008 Maxence Laurent, MIS-TIC, HEIG-VD - * University of Applied Sciences, Western Switzerland - * http://www.hes-so.ch - * - * Contact: - * maxence.laurent heig-vd ch - * or - * eric.taillard heig-vd ch - * - * This file is part of libpal. - * - * libpal is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * libpal 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 libpal. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef _LABEL_H -#define _LABEL_H - -namespace pal -{ - - class LabelPosition; - class PalGeometry; - - /** - * \brief Represent a label to be displayed - */ - class Label - { - - friend class LabelPosition; - private: - double x[4]; - double y[4]; - - double a; - - char *featureId; - char *lyrName; - - PalGeometry *userGeom; - - /** - * \brief Create a new label - * - * @param x x coordinate of down-left label corner - * @param y y coordinate of down-left label corner - * @param alpha rotation to aplay to the text - * @param ftid id of the corresponding feature - * @param lyrName name of the corresponding layer - * @param userGeom PalGeometry of the feature - */ - Label( double x[4], double y[4], double alpha, const char *ftid, const char *lyrName, PalGeometry *userGeom ); - - public: - /** - * \brief delete a label - */ - ~Label(); - - /** - * \brief return the down-left x coordinate - * @return x coordinate - */ - double getOrigX(); - - /** - * \brief return the down-left y coordinate - * @return y coordinate - */ - double getOrigY(); - - /** - * \brief get a specific x coordinate - * @param i 0 => down-left, 1=>down-right, 2=>up-right 3=> up-left - * @return the i'th x coordinate - */ - double getX( size_t i ); - - /** - * \brief get a specific y coordinate - * @param i 0 => down-left, 1=>down-right, 2=>up-right 3=> up-left - * @return the i'th y coordinate - */ - double getY( size_t i ); - - /** - * \brief return the label orientation - * @return alpha in rad, couterclockwise - */ - double getRotation(); - - /** - * \brief return the name of the layer wich contains the feature - * @return the layer's name - */ - const char *getLayerName(); - - /** - * \brief return the feature's unique id - * @return the feature's id - */ - const char *getFeatureId(); - - /** - * \brief return user geometry (pal::Layer::registerFeature()) - * @return pointer to the user geometry - */ - PalGeometry * getGeometry(); - }; - -} // end namespace pal - -#endif diff --git a/src/core/pal/labelposition.cpp b/src/core/pal/labelposition.cpp index ef2f9b134fbd..d4c54635b466 100644 --- a/src/core/pal/labelposition.cpp +++ b/src/core/pal/labelposition.cpp @@ -41,7 +41,6 @@ #include #include -#include #include "costcalculator.h" #include "feature.h" diff --git a/src/core/pal/pal.cpp b/src/core/pal/pal.cpp index 583585b64526..c0eb3adb2ed4 100644 --- a/src/core/pal/pal.cpp +++ b/src/core/pal/pal.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "linkedlist.hpp" #include "rtree.hpp" diff --git a/src/core/pal/pal.h b/src/core/pal/pal.h index 1059e49f6937..da3958f130ec 100644 --- a/src/core/pal/pal.h +++ b/src/core/pal/pal.h @@ -34,8 +34,6 @@ #ifndef _PAL_H #define _PAL_H -#include -#include #include #include @@ -62,6 +60,7 @@ namespace pal class Layer; class LabelPosition; + class PalStat; class Problem; class PointSet; class SimpleMutex; diff --git a/src/core/pal/palgeometry.h b/src/core/pal/palgeometry.h index 9a5bfbf2fde4..c2b2ba59fb34 100644 --- a/src/core/pal/palgeometry.h +++ b/src/core/pal/palgeometry.h @@ -30,8 +30,7 @@ #ifndef _PAL_GEOMETRY_H #define _PAL_GEOMETRY_H -#include -#include +#include // for size_t needed in geos_c.h #include namespace pal @@ -43,13 +42,6 @@ namespace pal class CORE_EXPORT PalGeometry { public: - /* - * \brief get the geometry in WKB hexa format - * This method is called by Pal each time it needs a geom's coordinates - * - * @return WKB Hex buffer - */ - //virtual char * getWkbHexBuffer() = 0; /** * \brief get the GEOSGeometry of the feature @@ -67,20 +59,6 @@ namespace pal virtual void releaseGeosGeometry( GEOSGeometry *the_geom ) = 0; - /* - * \brief Called by Pal when it doesn't need the coordinates anymore - * @param wkbBuffer is the WkbBuffer from PalGeometry::getWkbHexBuffer() - */ - //virtual void releaseWkbHexBuffer(char *wkbBuffer) = 0; - - /* - * \brief Give back a label to display - * Pal call this method when label will no move anymore. - * - * @param label the label to disploy - */ - //virtual void addLabel(Label *label) = 0; - virtual ~PalGeometry() {} }; diff --git a/src/core/pal/problem.cpp b/src/core/pal/problem.cpp index 1a7ccf3a79c5..37bebcb45443 100644 --- a/src/core/pal/problem.cpp +++ b/src/core/pal/problem.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include "linkedlist.hpp" #include "rtree.hpp" diff --git a/src/core/qgspalobjectpositionmanager.cpp b/src/core/qgspalobjectpositionmanager.cpp index f2f8dd00356e..f3791bea8576 100644 --- a/src/core/qgspalobjectpositionmanager.cpp +++ b/src/core/qgspalobjectpositionmanager.cpp @@ -109,7 +109,6 @@ void QgsPALObjectPositionManager::findObjectPositions( const QgsRenderContext& r double bbox[4]; bbox[0] = viewExtent.xMinimum(); bbox[1] = viewExtent.yMinimum(); bbox[2] = viewExtent.xMaximum(); bbox[3] = viewExtent.yMaximum(); - pal::PalStat* stat = 0; //set map units pal::Units mapUnits; switch ( unitType ) @@ -132,8 +131,7 @@ void QgsPALObjectPositionManager::findObjectPositions( const QgsRenderContext& r mPositionEngine.setMapUnit( mapUnits ); mPositionEngine.setDpi( renderContext.scaleFactor() * 25.4 ); - std::list* resultLabelList = mPositionEngine.labeller( renderContext.rendererScale(), bbox, &stat, false ); - delete stat; + std::list* resultLabelList = mPositionEngine.labeller( renderContext.rendererScale(), bbox, NULL, false ); //and read the positions back to the overlay objects if ( !resultLabelList )