[QGIS Commit] r11177 - in branches/symbology-ng-branch/src: core core/pal plugins/labeling

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Jul 25 17:24:14 EDT 2009


Author: wonder
Date: 2009-07-25 17:24:13 -0400 (Sat, 25 Jul 2009)
New Revision: 11177

Modified:
   branches/symbology-ng-branch/src/core/pal/costcalculator.cpp
   branches/symbology-ng-branch/src/core/pal/costcalculator.h
   branches/symbology-ng-branch/src/core/pal/feature.cpp
   branches/symbology-ng-branch/src/core/pal/feature.h
   branches/symbology-ng-branch/src/core/pal/labelposition.cpp
   branches/symbology-ng-branch/src/core/pal/labelposition.h
   branches/symbology-ng-branch/src/core/pal/pointset.h
   branches/symbology-ng-branch/src/core/qgspalobjectpositionmanager.cpp
   branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp
   branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h
Log:
Got rid of StraightLabelPosition class in favour of using only LabelPosition class.


Modified: branches/symbology-ng-branch/src/core/pal/costcalculator.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/pal/costcalculator.cpp	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/costcalculator.cpp	2009-07-25 21:24:13 UTC (rev 11177)
@@ -60,7 +60,7 @@
 
   ////////
 
-  void CostCalculator::setPolygonCandidatesCost( int nblp, StraightLabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
+  void CostCalculator::setPolygonCandidatesCost( int nblp, LabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
   {
     int i;
 
@@ -118,7 +118,7 @@
   }
 
 
-  void CostCalculator::setCandidateCostFromPolygon( StraightLabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
+  void CostCalculator::setCandidateCostFromPolygon( LabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
   {
 
     double amin[2];
@@ -188,7 +188,7 @@
       {
         int arrangement = feat->feature->getLayer()->getArrangement();
         if ( arrangement == P_FREE || arrangement == P_HORIZ )
-          setPolygonCandidatesCost( stop, (StraightLabelPosition**) feat->lPos, max_p, obstacles, bbx, bby );
+          setPolygonCandidatesCost( stop, (LabelPosition**) feat->lPos, max_p, obstacles, bbx, bby );
       }
 
       return max_p;
@@ -198,7 +198,7 @@
 
   //////////
 
-  PolygonCostCalculator::PolygonCostCalculator( StraightLabelPosition *lp ) : lp( lp )
+  PolygonCostCalculator::PolygonCostCalculator( LabelPosition *lp ) : lp( lp )
   {
     int i;
     double hyp = max( lp->feature->xmax - lp->feature->xmin, lp->feature->ymax - lp->feature->ymin );

Modified: branches/symbology-ng-branch/src/core/pal/costcalculator.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/costcalculator.h	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/costcalculator.h	2009-07-25 21:24:13 UTC (rev 11177)
@@ -6,7 +6,6 @@
 namespace pal
 {
   class Feats;
-  class StraightLabelPosition;
 
   class CostCalculator
   {
@@ -14,10 +13,10 @@
     /** increase candidate's cost according to its collision with passed feature */
     static void addObstacleCostPenalty(LabelPosition* lp, PointSet* feat);
 
-    static void setPolygonCandidatesCost( int nblp, StraightLabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
+    static void setPolygonCandidatesCost( int nblp, LabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
 
     /** Set cost to the smallest distance between lPos's centroid and a polygon stored in geoetry field */
-    static void setCandidateCostFromPolygon( StraightLabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
+    static void setCandidateCostFromPolygon( LabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
 
     /** sort candidates by costs, skip the worse ones, evaluate polygon candidates */
     static int finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
@@ -32,7 +31,7 @@
    */
   class PolygonCostCalculator
   {
-      StraightLabelPosition *lp;
+      LabelPosition *lp;
       double px, py;
       double dist[8];
       double rpx[8];
@@ -42,7 +41,7 @@
       void updatePoint( PointSet *pset );
       double updateLinePoly( PointSet *pset );
     public:
-      PolygonCostCalculator( StraightLabelPosition *lp );
+      PolygonCostCalculator( LabelPosition *lp );
 
       void update( PointSet *pset );
 

Modified: branches/symbology-ng-branch/src/core/pal/feature.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/pal/feature.cpp	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/feature.cpp	2009-07-25 21:24:13 UTC (rev 11177)
@@ -166,11 +166,11 @@
     double offset = label_x / 4;
 
     // at the center
-    ( *lPos )[0] = new StraightLabelPosition( id, lx, ly, label_x, label_y, alpha, cost,  this );
+    ( *lPos )[0] = new LabelPosition( id, lx, ly, label_x, label_y, alpha, cost,  this );
     // shifted to the sides - with higher cost
     cost = 0.0021;
-    ( *lPos )[1] = new StraightLabelPosition( id, lx+offset, ly, label_x, label_y, alpha, cost,  this );
-    ( *lPos )[2] = new StraightLabelPosition( id, lx-offset, ly, label_x, label_y, alpha, cost,  this );
+    ( *lPos )[1] = new LabelPosition( id, lx+offset, ly, label_x, label_y, alpha, cost,  this );
+    ( *lPos )[2] = new LabelPosition( id, lx-offset, ly, label_x, label_y, alpha, cost,  this );
     return nbp;
   }
 
@@ -317,7 +317,7 @@
       else
         cost =  0.0001 + 0.0020 * double( icost ) / double( nbp - 1 );
 
-      ( *lPos )[i] = new StraightLabelPosition( i, lx, ly, xrm, yrm, 0, cost,  this );
+      ( *lPos )[i] = new LabelPosition( i, lx, ly, xrm, yrm, 0, cost,  this );
 
       icost += inc;
 
@@ -489,15 +489,15 @@
           reversed = ( alpha >= M_PI/2 || alpha < -M_PI/2 );
 
         if ( (!reversed && (flags & FLAG_ABOVE_LINE)) || (reversed && (flags & FLAG_BELOW_LINE)) )
-          positions->push_back( new StraightLabelPosition( i, bx + cos( beta ) *distlabel , by + sin( beta ) *distlabel, xrm, yrm, alpha, cost, this ) ); // Line
+          positions->push_back( new LabelPosition( i, bx + cos( beta ) *distlabel , by + sin( beta ) *distlabel, xrm, yrm, alpha, cost, this ) ); // Line
         if ( (!reversed && (flags & FLAG_BELOW_LINE)) || (reversed && (flags & FLAG_ABOVE_LINE)) )
-          positions->push_back( new StraightLabelPosition( i, bx - cos( beta ) * ( distlabel + yrm ) , by - sin( beta ) * ( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
+          positions->push_back( new LabelPosition( i, bx - cos( beta ) * ( distlabel + yrm ) , by - sin( beta ) * ( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
         if ( flags & FLAG_ON_LINE )
-          positions->push_back( new StraightLabelPosition( i, bx - yrm*cos( beta ) / 2, by - yrm*sin( beta ) / 2, xrm, yrm, alpha, cost, this ) ); // Line
+          positions->push_back( new LabelPosition( i, bx - yrm*cos( beta ) / 2, by - yrm*sin( beta ) / 2, xrm, yrm, alpha, cost, this ) ); // Line
       }
       else if (layer->arrangement == P_HORIZ)
       {
-        positions->push_back( new StraightLabelPosition(i, bx - xrm/2, by - yrm/2, xrm, yrm, 0, cost, this) ); // Line
+        positions->push_back( new LabelPosition(i, bx - xrm/2, by - yrm/2, xrm, yrm, 0, cost, this) ); // Line
         //positions->push_back( new LabelPosition(i, bx -yrm/2, by - yrm*sin(beta)/2, xrm, yrm, alpha, cost, this, line)); // Line
       }
       else
@@ -533,7 +533,7 @@
   }
 
 
-  StraightLabelPosition* Feature::curvedPlacementAtOffset( PointSet* path_positions, double* path_distances, int orientation, int index, double distance )
+  LabelPosition* Feature::curvedPlacementAtOffset( PointSet* path_positions, double* path_distances, int orientation, int index, double distance )
   {
     // Check that the given distance is on the given index and find the correct index and distance if not
     while (distance < 0 && index > 1)
@@ -582,8 +582,8 @@
       return NULL;
     }
 
-    StraightLabelPosition* slp = NULL;
-    StraightLabelPosition* slp_tmp = NULL;
+    LabelPosition* slp = NULL;
+    LabelPosition* slp_tmp = NULL;
     // current_placement = placement_result()
     double xBase = old_x + dx*distance/segment_length;
     double yBase = old_y + dy*distance/segment_length;
@@ -690,7 +690,7 @@
       }
 
       std::cerr << "adding part: " << render_x << "  " << render_y << std::endl;
-      StraightLabelPosition* tmp = new StraightLabelPosition(0, render_x /*- xBase*/, render_y /*- yBase*/, ci.width, string_height, -render_angle, 0.0001, this);
+      LabelPosition* tmp = new LabelPosition(0, render_x /*- xBase*/, render_y /*- yBase*/, ci.width, string_height, -render_angle, 0.0001, this);
       tmp->setPartId( orientation > 0 ? i : labelInfo->char_num-i-1 );
       if (slp == NULL)
         slp = tmp;
@@ -752,7 +752,7 @@
     // TODO: generate more labels
 
     // generate curved label
-    StraightLabelPosition* slp = curvedPlacementAtOffset(mapShape, path_distances, 0, 1, 0.0);
+    LabelPosition* slp = curvedPlacementAtOffset(mapShape, path_distances, 0, 1, 0.0);
 
     if (!slp)
       return 0;
@@ -972,7 +972,7 @@
               if ( isPointInPolygon( mapShape->nbPoints, mapShape->x, mapShape->y, rx,  ry ) )
               {
                 // cost is set to minimal value, evaluated later
-                positions->push_back( new StraightLabelPosition( id++, rx - dlx, ry - dly , xrm, yrm, alpha, 0.0001, this ) ); // Polygon
+                positions->push_back( new LabelPosition( id++, rx - dlx, ry - dly , xrm, yrm, alpha, 0.0001, this ) ); // Polygon
               }
             }
           }

Modified: branches/symbology-ng-branch/src/core/pal/feature.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/feature.h	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/feature.h	2009-07-25 21:24:13 UTC (rev 11177)
@@ -73,7 +73,7 @@
     CharacterInfo* char_info;
   };
 
-  class StraightLabelPosition;
+  class LabelPosition;
 
   /**
    * \brief Main class to handle feature
@@ -132,7 +132,7 @@
        */
       int setPositionForLine( double scale, LabelPosition ***lPos, PointSet *mapShape, double delta_width );
 
-      StraightLabelPosition* curvedPlacementAtOffset( PointSet* path_positions, double* path_distances,
+      LabelPosition* curvedPlacementAtOffset( PointSet* path_positions, double* path_distances,
                                                       int orientation, int index, double distance );
 
       /**

Modified: branches/symbology-ng-branch/src/core/pal/labelposition.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/pal/labelposition.cpp	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/labelposition.cpp	2009-07-25 21:24:13 UTC (rev 11177)
@@ -55,15 +55,10 @@
 
 namespace pal
 {
-  LabelPosition::LabelPosition( int id, double cost, Feature *feature )
-   : id( id ), cost( cost ), feature( feature ), nbOverlap( 0 )
+  LabelPosition::LabelPosition( int id, double x1, double y1, double w, double h, double alpha, double cost, Feature *feature )
+    : id( id ), cost( cost ), feature( feature ), nbOverlap( 0 ), alpha( alpha ), w( w ), h( h ), nextPart(NULL), partId(-1)
   {
-  }
 
-  StraightLabelPosition::StraightLabelPosition( int id, double x1, double y1, double w, double h, double alpha, double cost, Feature *feature )
-    : LabelPosition( id, cost, feature ), alpha( alpha ), w( w ), h( h ), nextPart(NULL), partId(-1)
-  {
-
     // alpha take his value bw 0 and 2*pi rad
     while ( this->alpha > 2*M_PI )
       this->alpha -= 2 * M_PI;
@@ -123,7 +118,7 @@
     }
   }
 
-  bool StraightLabelPosition::isIn( double *bbox )
+  bool LabelPosition::isIn( double *bbox )
   {
     int i;
 
@@ -141,7 +136,7 @@
 
   }
 
-  void StraightLabelPosition::print()
+  void LabelPosition::print()
   {
     std::cout << feature->getLayer()->getName() << "/" << feature->getUID() << "/" << id;
     std::cout << " cost: " << cost;
@@ -153,15 +148,12 @@
     std::cout << std::endl;
   }
 
-  bool StraightLabelPosition::isInConflict( LabelPosition *lp )
+  bool LabelPosition::isInConflict( LabelPosition *lp )
   {
-    // TODO: more types of labelposition
-    StraightLabelPosition* ls = (StraightLabelPosition*) lp;
-
     int i, i2, j;
     int d1, d2;
 
-    if ( this->probFeat == ls->probFeat ) // bugfix #1
+    if ( this->probFeat == lp->probFeat ) // bugfix #1
       return false; // always overlaping itself !
 
     double cp1, cp2;
@@ -176,14 +168,14 @@
       //std::cout << "new seg..." << std::endl;
       for ( j = 0;j < 4;j++ )
       {
-        cp1 = cross_product( x[i], y[i], x[i2], y[i2], ls->x[j], ls->y[j] );
+        cp1 = cross_product( x[i], y[i], x[i2], y[i2], lp->x[j], lp->y[j] );
         if ( cp1 > 0 )
         {
           d1 = 1;
           //std::cout << "    cp1: " << cp1 << std::endl;
         }
-        cp2 = cross_product( ls->x[i], ls->y[i],
-                             ls->x[i2], ls->y[i2],
+        cp2 = cross_product( lp->x[i], lp->y[i],
+                             lp->x[i2], lp->y[i2],
                              x[j], y[j] );
 
         if ( cp2 > 0 )
@@ -195,9 +187,9 @@
 
       if ( d1 == -1 || d2 == -1 ) // disjoint
       {
-        if ( ls->getNextPart() )
+        if ( lp->getNextPart() )
         {
-          if ( isInConflict(ls->getNextPart()) )
+          if ( isInConflict(lp->getNextPart()) )
             return true;
         }
 
@@ -215,17 +207,17 @@
     return id;
   }
 
-  double StraightLabelPosition::getX( int i ) const
+  double LabelPosition::getX( int i ) const
   {
     return (i >= 0 && i < 4 ? x[i] : -1);
   }
 
-  double StraightLabelPosition::getY( int i ) const
+  double LabelPosition::getY( int i ) const
   {
     return (i >= 0 && i < 4 ? y[i] : -1);
   }
 
-  double StraightLabelPosition::getAlpha() const
+  double LabelPosition::getAlpha() const
   {
     return alpha;
   }
@@ -249,7 +241,7 @@
     return feature;
   }
 
-  void StraightLabelPosition::getBoundingBox(double amin[2], double amax[2]) const
+  void LabelPosition::getBoundingBox(double amin[2], double amax[2]) const
   {
     if (nextPart)
     {
@@ -410,7 +402,7 @@
 
 
 
-  double StraightLabelPosition::getDistanceToPoint( double xp, double yp )
+  double LabelPosition::getDistanceToPoint( double xp, double yp )
   {
     int i;
     int j;
@@ -464,7 +456,7 @@
   }
 
 
-  bool StraightLabelPosition::isBorderCrossingLine( PointSet* feat )
+  bool LabelPosition::isBorderCrossingLine( PointSet* feat )
   {
     double ca, cb;
     for ( int i = 0;i < 4;i++ )
@@ -494,7 +486,7 @@
     return false;
   }
 
-  int StraightLabelPosition::getNumPointsInPolygon( int npol, double *xp, double *yp )
+  int LabelPosition::getNumPointsInPolygon( int npol, double *xp, double *yp )
   {
     int a, k, count = 0;
     double px, py;

Modified: branches/symbology-ng-branch/src/core/pal/labelposition.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/labelposition.h	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/labelposition.h	2009-07-25 21:24:13 UTC (rev 11177)
@@ -66,26 +66,41 @@
 
       int nbOverlap;
 
+      double x[4], y[4];
+      double alpha;
+      double w;
+      double h;
+
+      LabelPosition* nextPart;
+      int partId;
+
     public:
       /**
        * \brief create a new LabelPosition
        *
        * \param id id of this labelposition
+       * \param x1 down-left x coordinate
+       * \param y1 down-left y coordinate
+       * \param w label width
+       * \param h label height
+       * \param alpha rotation in rad
        * \param cost geographic cost
        * \param feature labelpos owners
        */
-      LabelPosition( int id, double cost, Feature *feature );
+      LabelPosition( int id, double x1, double y1,
+                     double w, double h,
+                     double alpha, double cost,
+                     Feature *feature );
 
-      // virtual functions
+      ~LabelPosition() { delete nextPart; }
 
-      virtual ~LabelPosition() {}
 
       /**
        * \brief is the labelposition in the bounding-box ?
        *
        *\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
        */
-      virtual bool isIn( double *bbox ) = 0;
+      bool isIn( double *bbox );
 
       /**
        * \brief Check whether or not this overlap with another labelPosition
@@ -93,22 +108,22 @@
        * \param ls other labelposition
        * \return true or false
        */
-      virtual bool isInConflict( LabelPosition *ls ) = 0;
+      bool isInConflict( LabelPosition *ls );
 
       /** return bounding box - amin: xmin,ymin - amax: xmax,ymax */
-      virtual void getBoundingBox(double amin[2], double amax[2]) const = 0;
+      void getBoundingBox(double amin[2], double amax[2]) const;
 
       /** get distance from this label to a point. If point lies inside, returns negative number. */
-      virtual double getDistanceToPoint( double xp, double yp ) = 0;
+      double getDistanceToPoint( double xp, double yp );
 
       /** returns true if this label crosses the specified line */
-      virtual bool isBorderCrossingLine( PointSet* feat ) = 0;
+      bool isBorderCrossingLine( PointSet* feat );
 
       /** returns number of intersections with polygon (testing border and center) */
-      virtual int getNumPointsInPolygon( int npol, double *xp, double *yp ) = 0;
+      int getNumPointsInPolygon( int npol, double *xp, double *yp );
 
-      // end of virtual functions
 
+
       /** \brief return id
        * \return id
        */
@@ -126,7 +141,8 @@
       int getProblemFeatureId() const { return probFeat; }
       /** set problem feature ID and assigned label candidate ID.
        *  called from pal.cpp during extraction */
-      virtual void setProblemIds( int probFid, int lpId ) { probFeat = probFid; id = lpId; }
+      void setProblemIds( int probFid, int lpId ) { probFeat = probFid; id = lpId;
+        if (nextPart) nextPart->setProblemIds(probFid, lpId); }
 
       /** return pointer to layer's name. used for stats */
       char* getLayerName() const;
@@ -143,12 +159,37 @@
       /** Make sure the cost is less than 1 */
       void validateCost();
 
+
       /**
-       * \brief get a final lable from this
-       * \return a new Label() object
+       * \brief get the down-left x coordinate
+       * \return x coordinate
        */
-      //Label* toLabel( bool active );
+      double getX( int i = 0 ) const;
+      /**
+       * \brief get the down-left y coordinate
+       * \return y coordinate
+       */
+      double getY( int i = 0 ) const;
 
+      double getWidth() const { return w; }
+      double getHeight() const { return h; }
+
+      /**
+       * \brief get alpha
+       * \return alpha to rotate text (in rad)
+       */
+      double getAlpha() const;
+
+      void print();
+
+      LabelPosition* getNextPart() const { return nextPart; }
+      void setNextPart(LabelPosition* next) { nextPart = next; }
+
+      // -1 if not multi-part
+      int getPartId() const { return partId; }
+      void setPartId(int id) { partId = id; }
+
+
       void removeFromIndex( RTree<LabelPosition*, double, 2, double> *index );
       void insertIntoIndex( RTree<LabelPosition*, double, 2, double> *index );
 
@@ -190,92 +231,6 @@
 
   };
 
-
-  class StraightLabelPosition : public LabelPosition
-  {
-      friend class CostCalculator;
-      friend class PolygonCostCalculator;
-
-    public:
-      /**
-       * \brief create a new LabelPosition
-       *
-       * \param id id of this labelposition
-       * \param x1 down-left x coordinate
-       * \param y1 down-left y coordinate
-       * \param w label width
-       * \param h label height
-       * \param alpha rotation in rad
-       * \param cost geographic cost
-       * \param feature labelpos owners
-       */
-      StraightLabelPosition( int id, double x1, double y1,
-                             double w, double h,
-                             double alpha, double cost,
-                             Feature *feature );
-
-      ~StraightLabelPosition() { delete nextPart; }
-
-      // virtual functions
-
-      virtual bool isIn( double *bbox );
-      virtual bool isInConflict( LabelPosition *ls );
-
-      virtual void getBoundingBox(double amin[2], double amax[2]) const;
-
-      /** get distance from this label to a point. If point lies inside, returns negative number. */
-      virtual double getDistanceToPoint( double xp, double yp );
-
-      /** returns true if this label crosses the specified line */
-      virtual bool isBorderCrossingLine( PointSet* feat );
-
-      /** returns number of intersections with polygon (testing border and center) */
-      virtual int getNumPointsInPolygon( int npol, double *xp, double *yp );
-
-      // new functions
-
-      /**
-       * \brief get the down-left x coordinate
-       * \return x coordinate
-       */
-      double getX( int i = 0 ) const;
-      /**
-       * \brief get the down-left y coordinate
-       * \return y coordinate
-       */
-      double getY( int i = 0 ) const;
-
-      double getWidth() const { return w; }
-      double getHeight() const { return h; }
-
-      /**
-       * \brief get alpha
-       * \return alpha to rotate text (in rad)
-       */
-      double getAlpha() const;
-
-      void print();
-
-      StraightLabelPosition* getNextPart() const { return nextPart; }
-      void setNextPart(StraightLabelPosition* next) { nextPart = next; }
-
-      // -1 if not multi-part
-      int getPartId() const { return partId; }
-      void setPartId(int id) { partId = id; }
-
-      void setProblemIds( int probFid, int lpId ) {
-        LabelPosition::setProblemIds(probFid, lpId);
-        if (nextPart) nextPart->setProblemIds(probFid, lpId); }
-      
-    protected:
-      double x[4], y[4];
-      double alpha;
-      double w;
-      double h;
-      StraightLabelPosition* nextPart;
-      int partId;
-    };
-
 } // end namespac
 
 #endif

Modified: branches/symbology-ng-branch/src/core/pal/pointset.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/pointset.h	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/pal/pointset.h	2009-07-25 21:24:13 UTC (rev 11177)
@@ -93,7 +93,7 @@
   class PointSet
   {
       friend class Feature;
-      friend class StraightLabelPosition;
+      friend class LabelPosition;
       friend class CostCalculator;
       friend class PolygonCostCalculator;
       friend void extractXYCoord( Feat *f );

Modified: branches/symbology-ng-branch/src/core/qgspalobjectpositionmanager.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/qgspalobjectpositionmanager.cpp	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/core/qgspalobjectpositionmanager.cpp	2009-07-25 21:24:13 UTC (rev 11177)
@@ -159,7 +159,7 @@
       continue;
     }
 
-    pal::StraightLabelPosition* lp = (pal::StraightLabelPosition*) *labelIt;
+    pal::LabelPosition* lp = *labelIt;
 
     //QGIS takes the coordinates of the middle points
     double x = (lp->getX( 0 ) + lp->getX( 1 ) + lp->getX( 2 ) + lp->getX( 3 ) ) / 4;

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-07-25 21:24:13 UTC (rev 11177)
@@ -372,7 +372,7 @@
     {
       for (int j = 0; j < problem->getFeatureCandidateCount(i); j++)
       {
-        pal::StraightLabelPosition* lp = (pal::StraightLabelPosition*) problem->getFeatureCandidate(i, j);
+        pal::LabelPosition* lp = problem->getFeatureCandidate(i, j);
 
         drawLabelCandidateRect(lp, painter, xform);
       }
@@ -389,9 +389,7 @@
   std::list<LabelPosition*>::iterator it = labels->begin();
   for ( ; it != labels->end(); ++it)
   {
-    StraightLabelPosition* label = (StraightLabelPosition*) *it;
-
-    drawLabel( label, painter, xform );
+    drawLabel( *it, painter, xform );
   }
 
   std::cout << "LABELING draw:   " << t.elapsed() << "ms" << std::endl;
@@ -436,7 +434,7 @@
   return mSearch;
 }
 
-void PalLabeling::drawLabelCandidateRect( pal::StraightLabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform )
+void PalLabeling::drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform )
 {
   QgsPoint outPt = xform->transform(lp->getX(), lp->getY());
   QgsPoint outPt2 = xform->transform(lp->getX()+lp->getWidth(), lp->getY()+lp->getHeight());
@@ -458,7 +456,7 @@
 }
 
 
-void PalLabeling::drawLabel( pal::StraightLabelPosition* label, QPainter* painter, const QgsMapToPixel* xform)
+void PalLabeling::drawLabel( pal::LabelPosition* label, QPainter* painter, const QgsMapToPixel* xform)
 {
   QgsPoint outPt = xform->transform(label->getX(), label->getY());
 

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-07-25 11:21:44 UTC (rev 11176)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-07-25 21:24:13 UTC (rev 11177)
@@ -16,7 +16,7 @@
 {
   class Pal;
   class Layer;
-  class StraightLabelPosition;
+  class LabelPosition;
 }
 
 class QgsMapToPixel;
@@ -122,8 +122,8 @@
     static void registerFeatureHook(QgsFeature& f, void* layerContext);
 
 
-    void drawLabelCandidateRect( pal::StraightLabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform );
-    void drawLabel( pal::StraightLabelPosition* label, QPainter* painter, const QgsMapToPixel* xform);
+    void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform );
+    void drawLabel( pal::LabelPosition* label, QPainter* painter, const QgsMapToPixel* xform);
     static void drawLabelBuffer(QPainter* p, QString text, int size, QColor color);
 
 protected:



More information about the QGIS-commit mailing list