2828 */
2929
3030// #define _VERBOSE_
31- // #define _EXPORT_MAP_
3231#include < QTime>
3332
3433#define _CRT_SECURE_NO_DEPRECATE
@@ -211,9 +210,6 @@ namespace pal
211210 double priority;
212211 double bbox_min[2 ];
213212 double bbox_max[2 ];
214- #ifdef _EXPORT_MAP_
215- std::ofstream *svgmap;
216- #endif
217213 } FeatCallBackCtx;
218214
219215
@@ -229,12 +225,6 @@ namespace pal
229225
230226 FeatCallBackCtx *context = ( FeatCallBackCtx* ) ctx;
231227
232- #ifdef _EXPORT_MAP_
233- bool svged = false ; // is the feature has been written into the svg map?
234- int dpi = context->layer ->pal ->getDpi ();
235- #endif
236-
237-
238228#ifdef _DEBUG_FULL_
239229 std::cout << " extract feat : " << ft_ptr->getLayer ()->getName () << " /" << ft_ptr->getUID () << std::endl;
240230#endif
@@ -276,11 +266,7 @@ namespace pal
276266
277267 // generate candidates for the feature part
278268 LabelPosition** lPos = NULL ;
279- int nblp = ft_ptr->setPosition ( context->scale , &lPos, context->bbox_min , context->bbox_max , ft_ptr, context->candidates
280- #ifdef _EXPORT_MAP_
281- , *context->svgmap
282- #endif
283- );
269+ int nblp = ft_ptr->setPosition ( context->scale , &lPos, context->bbox_min , context->bbox_max , ft_ptr, context->candidates );
284270
285271 if ( nblp > 0 )
286272 {
@@ -335,23 +321,8 @@ namespace pal
335321 return true ;
336322 }
337323
338-
339- /* *
340- * \brief Problem Factory
341- * Select features from user's choice layers within
342- * a specific bounding box
343- * @param nbLayers # wanted layers
344- * @param layersFactor layers importance
345- * @param layersName layers in problem
346- * @param lambda_min west bbox
347- * @param phi_min south bbox
348- * @param lambda_max east bbox
349- * @param phi_max north bbox
350- * @param scale the scale
351- */
352- Problem* Pal::extract ( int nbLayers, char **layersName, double *layersFactor, double lambda_min, double phi_min, double lambda_max, double phi_max, double scale, std::ofstream *svgmap )
324+ Problem* Pal::extract ( int nbLayers, char **layersName, double *layersFactor, double lambda_min, double phi_min, double lambda_max, double phi_max, double scale )
353325 {
354- Q_UNUSED ( svgmap );
355326 // to store obstacles
356327 RTree<PointSet*, double , 2 , double > *obstacles = new RTree<PointSet*, double , 2 , double >();
357328
@@ -392,10 +363,6 @@ namespace pal
392363 context->bbox_max [0 ] = amax[0 ];
393364 context->bbox_max [1 ] = amax[1 ];
394365
395- #ifdef _EXPORT_MAP_
396- context->svgmap = svgmap;
397- #endif
398-
399366#ifdef _VERBOSE_
400367 std::cout << nbLayers << " /" << layers->size () << " layers to extract " << std::endl;
401368 std::cout << " scale is 1:" << scale << std::endl << std::endl;
@@ -436,20 +403,10 @@ namespace pal
436403 context->priority = layersFactor[i];
437404 // lookup for feature (and generates candidates list)
438405
439- #ifdef _EXPORT_MAP_
440- *svgmap << " <g inkscape:label=\" " << layer->name << " \" " << std::endl
441- << " inkscape:groupmode=\" layer\" " << std::endl
442- << " id=\" " << layer->name << " \" >" << std::endl << std::endl;
443- #endif
444-
445406 context->layer ->mMutex .lock ();
446407 context->layer ->rtree ->Search ( amin, amax, extractFeatCallback, ( void * ) context );
447408 context->layer ->mMutex .unlock ();
448409
449- #ifdef _EXPORT_MAP_
450- *svgmap << " </g>" << std::endl << std::endl;
451- #endif
452-
453410#ifdef _VERBOSE_
454411 std::cout << " Layer's name: " << layer->getName () << std::endl;
455412 std::cout << " scale range: " << layer->getMinScale () << " ->" << layer->getMaxScale () << std::endl;
@@ -708,35 +665,12 @@ namespace pal
708665 std::cout << std::endl << " bbox: " << bbox[0 ] << " " << bbox[1 ] << " " << bbox[2 ] << " " << bbox[3 ] << std::endl;
709666#endif
710667
711- #ifdef _EXPORT_MAP_
712- // TODO this is not secure
713- std::ofstream svgmap ( " pal-map.svg" );
714-
715- svgmap << " <?xml version=\" 1.0\" encoding=\" UTF-8\" standalone=\" no\" ?>" << std::endl
716- << " <svg" << std::endl
717- << " xmlns:dc=\" http://purl.org/dc/elements/1.1/\" " << std::endl
718- << " xmlns:cc=\" http://creativecommons.org/ns#\" " << std::endl
719- << " xmlns:rdf=\" http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " << std::endl
720- << " xmlns:svg=\" http://www.w3.org/2000/svg\" " << std::endl
721- << " xmlns=\" http://www.w3.org/2000/svg\" " << std::endl
722- << " xmlns:sodipodi=\" http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" " << std::endl
723- << " xmlns:inkscape=\" http://www.inkscape.org/namespaces/inkscape\" " << std::endl
724- << " width=\" " << convert2pt ( bbox[2 ] - bbox[0 ], scale, dpi ) << " \" " << std::endl
725- << " height=\" " << convert2pt ( bbox[3 ] - bbox[1 ], scale, dpi ) << " \" >" << std::endl; // TODO xmax ymax
726- #endif
727-
728668 QTime t;
729669 t.start ();
730670
731671 // First, extract the problem
732672 // TODO which is the minimum scale? (> 0, >= 0, >= 1, >1 )
733- if ( scale < 1 || ( prob = extract ( nbLayers, layersName, layersFactor, bbox[0 ], bbox[1 ], bbox[2 ], bbox[3 ], scale,
734- #ifdef _EXPORT_MAP_
735- & svgmap
736- #else
737- NULL
738- #endif
739- ) ) == NULL )
673+ if ( scale < 1 || ( prob = extract ( nbLayers, layersName, layersFactor, bbox[0 ], bbox[1 ], bbox[2 ], bbox[3 ], scale ) ) == NULL )
740674 {
741675
742676#ifdef _VERBOSE_
@@ -746,11 +680,6 @@ namespace pal
746680 std::cout << " empty problem... finishing" << std::endl;
747681#endif
748682
749- #ifdef _EXPORT_MAP_
750- svgmap << " </svg>" << std::endl;
751- svgmap.close ();
752- #endif
753-
754683 // nothing to be done => return an empty result set
755684 if ( stats )
756685 ( *stats ) = new PalStat ();
@@ -799,12 +728,6 @@ namespace pal
799728 if ( stats )
800729 *stats = prob->getStats ();
801730
802- #ifdef _EXPORT_MAP_
803- prob->drawLabels ( svgmap );
804- svgmap << " </svg>" << std::endl;
805- svgmap.close ();
806- #endif
807-
808731#ifdef _VERBOSE_
809732 clock_t total_time = clock () - start;
810733 std::cout << " Total time: " << double ( total_time ) / double ( CLOCKS_PER_SEC ) << std::endl;
@@ -847,7 +770,7 @@ namespace pal
847770 }
848771 mMutex .unlock ();
849772
850- Problem* prob = extract ( nbLayers, layersName, priorities, bbox[0 ], bbox[1 ], bbox[2 ], bbox[3 ], scale, NULL );
773+ Problem* prob = extract ( nbLayers, layersName, priorities, bbox[0 ], bbox[1 ], bbox[2 ], bbox[3 ], scale );
851774
852775 delete[] layersName;
853776 delete[] priorities;
0 commit comments