OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimMapCompositionSource.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: LGPL
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: Garrett Potts
9 //
10 //*************************************************************************
11 // $Id: ossimMapCompositionSource.cpp 21631 2012-09-06 18:10:55Z dburken $
12 
22 #include <ossim/base/ossimString.h>
23 #include <ossim/base/ossimDms.h>
24 #include <ossim/base/ossimTrace.h>
32 #include <sstream>
33 
34 using namespace std;
35 
36 static const char* GRID_TYPE_ENUM_NAMES[] = {"none", "line", "reseaux"};
37 static const char* VIEW_WIDTH_KW = "view_width";
38 static const char* VIEW_HEIGHT_KW = "view_height";
39 static const char* METER_GRID_SPACING_X_KW = "meter_grid_spacing_x";
40 static const char* METER_GRID_SPACING_Y_KW = "meter_grid_spacing_y";
41 static const char* GEO_GRID_SPACING_LON_KW = "geo_grid_spacing_lon";
42 static const char* GEO_GRID_SPACING_LAT_KW = "geo_grid_spacing_lat";
43 static const char* METER_GRID_TYPE_KW = "meter_grid_type";
44 static const char* GEO_GRID_TYPE_KW = "geo_grid_type";
45 static const char* TOP_BORDER_LENGTH_KW = "top_border_length";
46 static const char* BOTTOM_BORDER_LENGTH_KW = "bottom_border_length";
47 static const char* LEFT_BORDER_LENGTH_KW = "top_border_length";
48 static const char* RIGHT_BORDER_LENGTH_KW = "right_border_length";
49 static const char* BORDER_COLOR_KW = "border_color";
50 static const char* GEO_GRID_COLOR_KW = "geo_grid_color";
51 static const char* METER_GRID_COLOR_KW = "meter_grid_color";
52 static const char* TITLE_STRING_KW = "title_string";
53 static const char* TITLE_COLOR_KW = "title_color";
54 
55 static const char* TOP_GEO_LABEL_COLOR_KW = "top_geo_label_color";
56 static const char* BOTTOM_GEO_LABEL_COLOR_KW = "bottom_geo_label_color";
57 static const char* LEFT_GEO_LABEL_COLOR_KW = "left_geo_label_color";
58 static const char* RIGHT_GEO_LABEL_COLOR_KW = "right_geo_label_color";
59 
60 static const char* TOP_METER_LABEL_COLOR_KW = "top_meter_label_color";
61 static const char* BOTTOM_METER_LABEL_COLOR_KW = "bottom_meter_label_color";
62 static const char* LEFT_METER_LABEL_COLOR_KW = "left_meter_label_color";
63 static const char* RIGHT_METER_LABEL_COLOR_KW = "right_meter_label_color";
64 
65 static const char* TOP_GEO_LABEL_FORMAT_KW = "top_geo_label_format";
66 static const char* BOTTOM_GEO_LABEL_FORMAT_KW = "bottom_geo_label_format";
67 static const char* LEFT_GEO_LABEL_FORMAT_KW = "left_geo_label_format";
68 static const char* RIGHT_GEO_LABEL_FORMAT_KW = "right_geo_label_format";
69 
70 static const char* TOP_GEO_LABEL_FLAG_KW = "top_geo_label_flag";
71 static const char* BOTTOM_GEO_LABEL_FLAG_KW = "bottom_geo_label_flag";
72 static const char* LEFT_GEO_LABEL_FLAG_KW = "left_geo_label_flag";
73 static const char* RIGHT_GEO_LABEL_FLAG_KW = "right_geo_label_flag";
74 
75 static const char* TOP_METER_LABEL_FLAG_KW = "top_meter_label_flag";
76 static const char* BOTTOM_METER_LABEL_FLAG_KW = "bottom_meter_label_flag";
77 static const char* LEFT_METER_LABEL_FLAG_KW = "left_meter_label_flag";
78 static const char* RIGHT_METER_LABEL_FLAG_KW = "right_meter_label_flag";
79 
80 static const char* TOP_GEO_LABEL_FONT_KW = "top_geo_label_font";
81 static const char* BOTTOM_GEO_LABEL_FONT_KW = "bottom_geo_label_font";
82 static const char* LEFT_GEO_LABEL_FONT_KW = "left_geo_label_font";
83 static const char* RIGHT_GEO_LABEL_FONT_KW = "right_geo_label_font";
84 static const char* TOP_METER_LABEL_FONT_KW = "top_meter_label_font";
85 static const char* BOTTOM_METER_LABEL_FONT_KW = "bottom_meter_label_font";
86 static const char* LEFT_METER_LABEL_FONT_KW = "left_meter_label_font";
87 static const char* RIGHT_METER_LABEL_FONT_KW = "right_meter_label_font";
88 static const char* TITLE_FONT_KW = "title_font";
89 
90 static ossimTrace traceDebug("ossimMapCompositionSource:debug");
91 
92 RTTI_DEF1(ossimMapCompositionSource, "ossimMapCompositionSource", ossimAnnotationSource);
95  theMeterGridType(OSSIM_GRID_NONE),
96  theGeographicGridType(OSSIM_GRID_LINE),
97  theTopBorderLength(200),
98  theBottomBorderLength(200),
99  theLeftBorderLength(300),
100  theRightBorderLength(300),
101  theBorderColor(255,255,255),
102  theGeographicGridColor(255,255,255),
103  theMeterGridColor(255,255,255),
104  theTitleString(""),
105  theTitleFont(NULL),
106  theTitleColor(1, 1, 1),
107  theTopGeographicLabelColor(1, 1, 1),
108  theBottomGeographicLabelColor(1, 1, 1),
109  theLeftGeographicLabelColor(1, 1, 1),
110  theRightGeographicLabelColor(1, 1, 1),
111  theTopMeterLabelColor(1, 1, 1),
112  theBottomMeterLabelColor(1, 1, 1),
113  theLeftMeterLabelColor(1, 1, 1),
114  theRightMeterLabelColor(1, 1, 1),
115  theGeographicTopLabelFont(NULL),
116  theGeographicBottomLabelFont(NULL),
117  theGeographicLeftLabelFont(NULL),
118  theGeographicRightLabelFont(NULL),
119  theMeterTopLabelFont(NULL),
120  theMeterBottomLabelFont(NULL),
121  theMeterLeftLabelFont(NULL),
122  theMeterRightLabelFont(NULL),
123  theTopGeographicFormat("dd@mm'ss\".ssssC"),
124  theBottomGeographicFormat("dd@mm'ss\".ssssC"),
125  theLeftGeographicFormat("dd@mm'ss\".ssssC"),
126  theRightGeographicFormat("dd@mm'ss\".ssssC"),
127  theTopGeographicLabelFlag(true),
128  theBottomGeographicLabelFlag(true),
129  theLeftGeographicLabelFlag(true),
130  theRightGeographicLabelFlag(true),
131  theTopGeographicTickFlag(true),
132  theBottomGeographicTickFlag(true),
133  theLeftGeographicTickFlag(true),
134  theRightGeographicTickFlag(true),
135  theTopMeterLabelFlag(false),
136  theBottomMeterLabelFlag(false),
137  theLeftMeterLabelFlag(false),
138  theRightMeterLabelFlag(false),
139  theTopMeterTickFlag(false),
140  theBottomMeterTickFlag(false),
141  theLeftMeterTickFlag(false),
142  theRightMeterTickFlag(false),
143  theGeographicSpacing(1.0, 1.0),
144  theMeterSpacing(3600*30, 3600*30)
145 {
146  theViewWidthHeight = ossimIpt(-1,-1);
147  vector<ossimFontInformation> info;
149 
150  if(info.size())
151  {
155 
157  {
164 
173 
177  }
178  }
179 }
180 
182 {
190 
192  theTitleFont = 0;
194 }
195 
197  ossim_uint32 resLevel)
198 {
199  if(!theTile)
200  {
201  allocate(tileRect);
202  if(!theTile)
203  {
205  {
206  return theInputConnection->getTile(tileRect, resLevel);
207  }
208  }
209  }
210  theTile->setImageRectangle(tileRect);
211  theTile->makeBlank();
212 
214  {
216  resLevel);
217 
218  if(tile.valid())
219  {
220  if(tile->getScalarType() != OSSIM_UCHAR)
221  {
223  << "ossimMapCompositionSource::getTile\n"
224  << "Error input is not uchar" << endl;
225  return tile;
226  }
227  else
228  {
229  if(tile->getBuf()&&(tile->getDataObjectStatus() != OSSIM_EMPTY))
230  {
231  int band = 0;
232  int outBands = theTile->getNumberOfBands();
233  int minBand = std::min((long)theTile->getNumberOfBands(),
234  (long)tile->getNumberOfBands());
235  for(band = 0; band < minBand; ++band)
236  {
237  theTile->loadBand(tile->getBuf(band),
238  tile->getImageRectangle(),
239  band);
240  }
241  // copy last band of input tile to all output
242  // bands if the input tile did not have enough bands.
243  //
244  for(;band < outBands;++band)
245  {
246  theTile->loadBand(tile->getBuf(minBand-1),
247  tile->getImageRectangle(),
248  band);
249  }
250  }
251  drawBorders();
253  }
254  }
255  }
256  theTile->validate();
257  return theTile;
258 }
259 
261 {
262  if( (format == theTopGeographicFormat)&&
263  (format == theBottomGeographicFormat)&&
264  (format == theLeftGeographicFormat)&&
265  (format == theRightGeographicFormat))
266  {
267  return;
268  }
269  theTopGeographicFormat = format;
270  theBottomGeographicFormat = format;
271  theLeftGeographicFormat = format;
272  theRightGeographicFormat = format;
273 }
274 
276 {
277  if(format == theTopGeographicFormat)
278  {
279  return;
280  }
281  theTopGeographicFormat = format;
282 }
283 
285 {
286  if(format == theBottomGeographicFormat)
287  {
288  return;
289  }
290  theBottomGeographicFormat = format;
291 
292  // need to reset the fonts
293 // layoutAnnotations();
294 }
295 
297 {
298  if(format == theLeftGeographicFormat)
299  {
300  return;
301  }
302  theLeftGeographicFormat = format;
303 
304  // need to reset the fonts
305 // layoutAnnotations();
306 }
307 
309 {
310  if(format == theRightGeographicFormat)
311  {
312  return;
313  }
314  theRightGeographicFormat = format;
315 
316 }
317 
319 {
320  if(theTitleFontInfo == fontInfo)
321  {
322  return;
323  }
325  if(font)
326  {
327 
328  theTitleFont = font;
329  theTitleFontInfo = fontInfo;
330  }
331 }
332 
334 {
335  const char* MODULE = "ossimMapCompositionSource::setGeographicTopLabelFont";
336 
337  if(traceDebug())
338  {
339  CLOG << "Entering...." <<endl;
340  }
341  if(theGeographicTopLabelFontInfo == fontInfo)
342  {
343  if(traceDebug())
344  {
345  CLOG << "Font info the same exiting...." <<endl
347  }
348 
349  return;
350  }
352 
353  if(font)
354  {
355  if(traceDebug())
356  {
357  CLOG << "Previous font info " <<endl
358  << theGeographicTopLabelFont.get() << endl;
359  }
362 
363  if(traceDebug())
364  {
365  CLOG << "New font info " <<endl
366  << theGeographicTopLabelFont.get() << endl;
367  }
368  }
369 }
370 
372 {
373  if(theGeographicBottomLabelFontInfo == fontInfo)
374  {
375  return;
376  }
378 
379  if(font)
380  {
383 
384  }
385 }
386 
388 {
389  if(theGeographicRightLabelFontInfo == fontInfo)
390  {
391  return;
392  }
394 
395  if(font)
396  {
399 
400  }
401 }
402 
404 {
405  if(theGeographicRightLabelFontInfo == fontInfo)
406  {
407  return;
408  }
409 
411 
412  if(font)
413  {
416  }
417 }
418 
419 
421 {
422  if(theMeterTopLabelFontInfo == fontInfo)
423  {
424  return;
425  }
427 
428  if(font)
429  {
430  theMeterTopLabelFont = font;
431  theMeterTopLabelFontInfo = fontInfo;
432  }
433 }
434 
436 {
437  if(theMeterBottomLabelFontInfo == fontInfo)
438  {
439  return;
440  }
442 
443  if(font)
444  {
446  theMeterBottomLabelFontInfo = fontInfo;
447  }
448 }
449 
451 {
452  if(theMeterLeftLabelFontInfo == fontInfo)
453  {
454  return;
455  }
457 
458  if(font)
459  {
460  theMeterLeftLabelFont = font;
461  theMeterLeftLabelFontInfo = fontInfo;
462  }
463 }
464 
466 {
467  if(theMeterRightLabelFontInfo == fontInfo)
468  {
469  return;
470  }
472 
473  if(font)
474  {
475  theMeterRightLabelFont = font;
476  theMeterRightLabelFontInfo = fontInfo;
477  }
478 }
479 
481 {
482  ossimIrect result;
483 
484  result.makeNan();
486  {
487  ossimIrect inputRect = getViewingRect();
488 
489  if(!inputRect.hasNans())
490  {
491  ossimDpt decimation;
492  getDecimationFactor(resLevel,
493  decimation);
494  int leftBorderLength = theLeftBorderLength;
495  int rightBorderLength = theRightBorderLength;
496  int topBorderLength = theTopBorderLength;
497  int bottomBorderLength = theBottomBorderLength;
498 
499  ossimIpt p1(inputRect.ul().x - leftBorderLength,
500  inputRect.ul().y - topBorderLength);
501 
502  ossimIpt p2(inputRect.ur().x + rightBorderLength,
503  inputRect.ur().y - topBorderLength);
504 
505  ossimIpt p3(inputRect.lr().x + rightBorderLength,
506  inputRect.lr().y + bottomBorderLength);
507 
508  ossimIpt p4(inputRect.ll().x - leftBorderLength,
509  inputRect.ll().y + bottomBorderLength);
510 
511  result = ossimIrect(p1, p2, p3, p4);
512 
513  if(!decimation.hasNans())
514  {
515  result*=decimation;
516  }
517  }
518  }
519  return result;
520 }
521 
523 {
525 
526  addTitle();
527  addGridLabels();
529  {
531  }
533  {
535  }
536 
538  {
540  }
542  {
544  }
545 }
546 
547 
549 {
551 
552  theTile = 0;
554  {
557  }
558  else
559  {
561  }
562 }
563 
565 {
567  {
568  ossimIrect inputRect = getViewingRect();;
569 
571  inputRect.ul().y - theTopBorderLength,
572  inputRect.ur().x + theRightBorderLength,
573  inputRect.ur().y);
574 
576  inputRect.ll().y,
577  inputRect.lr().x + theRightBorderLength,
578  inputRect.lr().y + theBottomBorderLength);
579 
581  theTopBorder.ll().y,
582  inputRect.ll().x,
583  inputRect.ll().y);
584 
585  theRightBorder = ossimIrect(inputRect.ur().x,
586  inputRect.ur().y,
587  theBottomBorder.lr().x,
588  inputRect.lr().y);
589  }
590  else
591  {
596  }
597 
598 }
599 
601 {
602  if(theTile.valid())
603  {
604  ossimIrect top = theTopBorder;
605  ossimIrect bottom = theBottomBorder;
606  ossimIrect left = theLeftBorder;
607  ossimIrect right = theRightBorder;
608 
609 // if(resLevel)
610 // {
611 // ossimDpt decimation;
612 // getDecimationFactor(resLevel,
613 // decimation);
614 
615 // if(!decimation.hasNans())
616 // {
617 // top*=decimation;
618 // bottom*=decimation;
619 // left*=decimation;
620 // right*=decimation;
621 // }
622 // }
623  ossimIrect tileRect = theTile->getImageRectangle();
624 
625  ossimImageDataHelper helper(theTile.get());
626 
627  if(top.intersects(tileRect))
628  {
629  helper.fill(theBorderColor,
630  top.clipToRect(tileRect),false);
631  }
632  if(bottom.intersects(tileRect))
633  {
634  helper.fill(theBorderColor,
635  bottom.clipToRect(tileRect),false);
636  }
637  if(left.intersects(tileRect))
638  {
639  helper.fill(theBorderColor,
640  left.clipToRect(tileRect),false);
641  }
642  if(right.intersects(tileRect))
643  {
644  helper.fill(theBorderColor,
645  right.clipToRect(tileRect),false);
646  }
647  }
648 }
649 
651 {
656 
658 }
659 
661 {
662  const char* MODULE = "ossimMapCompositionSource::addGeographicTopGridLabels";
663  if(traceDebug())
664  {
665  CLOG << "Entering...." << endl;
666  }
668  {
669  if(traceDebug())
670  {
671  CLOG << "Exiting, flags are false...." << endl;
672  }
673  return;
674  }
675 
677  {
678  const ossimMapProjection* mapProj = inputMapProjection();
679  ossimGpt gpt[4];
680  ossimDrect rect = getViewingRect();
681 
682  if(rect.hasNans()) return;
683  mapProj->lineSampleToWorld(rect.ul(), gpt[0]);
684  mapProj->lineSampleToWorld(rect.ur(), gpt[1]);
685  mapProj->lineSampleToWorld(rect.lr(), gpt[2]);
686  mapProj->lineSampleToWorld(rect.ll(), gpt[3]);
687 
688  ossimDrect grect(gpt[0], gpt[1], gpt[2], gpt[3], OSSIM_RIGHT_HANDED);
689 
690  if(grect.hasNans()) return;
693 
696 
697  while(ulLatLon.lat > 90)
698  {
699  ulLatLon.lat -= theGeographicSpacing.lat;
700  }
701  while(ulLatLon.lon < -180)
702  {
703  ulLatLon.lon += theGeographicSpacing.lon;
704  }
705  while(lrLatLon.lat < -90)
706  {
707  ulLatLon.lat += theGeographicSpacing.lat;
708  }
709  while(lrLatLon.lon > 180)
710  {
711  ulLatLon.lon -= theGeographicSpacing.lon;
712  }
713 
714  ossimDrect latLonSpacing(ulLatLon,
715  lrLatLon,
717 
718  if(traceDebug())
719  {
720  CLOG << "labeling bounding geo rect = " << latLonSpacing << endl;
721  }
722  // do the top side labels.
723  for(double lon = latLonSpacing.ul().x; lon <= latLonSpacing.lr().x; lon+=theGeographicSpacing.x)
724  {
725  ossimDpt tipt; // top
726  ossimDpt bipt; // bottom
727 
728  ossimGpt tgpt(latLonSpacing.ul().y,
729  lon,
730  0.0,
731  gpt[0].datum());
732 
733  ossimGpt bgpt(latLonSpacing.lr().y,
734  lon,
735  0.0,
736  gpt[0].datum());
737 
738  mapProj->worldToLineSample(tgpt, tipt);
739  mapProj->worldToLineSample(bgpt, bipt);
740 
741 
742  if((!tipt.hasNans()&& !bipt.hasNans()) && rect.clip(tipt, bipt))
743  {
744  ossimIpt rounded(tipt);
745  if( (rounded.x >= rect.ul().x)&&
746  (rounded.x <= rect.lr().x))
747  {
749  {
750  ossimDms dms(tgpt.lond(), false);
751 
753  ossimAnnotationFontObject* lonLabel =
754  new ossimAnnotationFontObject(ossimIpt(0,0), dmsString);
757  lonLabel->computeBoundingRect();
758  ossimDrect boundsD;
759  lonLabel->getBoundingRect(boundsD);
760 
761  ossimIpt center( rounded.x, ossim::round<int>(rect.ul().y-(boundsD.height()/2)));
762 
764  lonLabel->setCenterPosition(center);
765  lonLabel->computeBoundingRect();
766 
767  ossimDrect labelRect;
768  lonLabel->getBoundingRect(labelRect);
769 
770  if(rect.intersects(labelRect))
771  {
772  ossimIrect intersection = rect.clipToRect(labelRect);
773  center.y -= ossim::round<int>(rect.ul().y - intersection.lr().y);
774  }
775 
776  center.y -= 24; // this will need to be the tick height later;
777  lonLabel->setCenterPosition(center);
778  lonLabel->computeBoundingRect();
779 
780  addFixedAnnotation(lonLabel);
781  }
783  {
785  (ossimIpt(rounded.x,ossim::round<int>(rect.ul().y-24)),
786  ossimIpt(rounded.x, ossim::round<int>(rect.ul().y)));
788  addFixedAnnotation(lineLabel);
789  }
790  }
791  }
792  }
793  }
794  if(traceDebug())
795  {
796  CLOG << "Exiting...." << endl;
797  }
798 }
799 
801 {
803  {
804  return;
805  }
806 
807  const ossimMapProjection* mapProj = inputMapProjection();
808  if(mapProj)
809  {
810  ossimGpt gpt[4];
811  ossimDrect rect = getViewingRect();
812 
813  if(rect.hasNans()) return;
814  mapProj->lineSampleToWorld(rect.ul(), gpt[0]);
815  mapProj->lineSampleToWorld(rect.ur(), gpt[1]);
816  mapProj->lineSampleToWorld(rect.lr(), gpt[2]);
817  mapProj->lineSampleToWorld(rect.ll(), gpt[3]);
818 
819  ossimDrect grect(gpt[0], gpt[1], gpt[2], gpt[3], OSSIM_RIGHT_HANDED);
820 
821  if(grect.hasNans()) return;
824 
827 
828  while(ulLatLon.lat > 90)
829  {
830  ulLatLon.lat -= theGeographicSpacing.lat;
831  }
832  while(ulLatLon.lon < -180)
833  {
834  ulLatLon.lon += theGeographicSpacing.lon;
835  }
836  while(lrLatLon.lat < -90)
837  {
838  ulLatLon.lat += theGeographicSpacing.lat;
839  }
840  while(lrLatLon.lon > 180)
841  {
842  ulLatLon.lon -= theGeographicSpacing.lon;
843  }
844 
845  ossimDrect latLonSpacing(ulLatLon,
846  lrLatLon,
848 
849  // do the top side labels.
850  for(double lon = latLonSpacing.ul().x; lon <= latLonSpacing.lr().x; lon+=theGeographicSpacing.x)
851  {
852  ossimDpt tipt; // top
853  ossimDpt bipt; // bottom
854 
855  ossimGpt tgpt(latLonSpacing.ul().y,
856  lon,
857  0.0,
858  gpt[0].datum());
859 
860  ossimGpt bgpt(latLonSpacing.lr().y,
861  lon,
862  0.0,
863  gpt[0].datum());
864 
865  mapProj->worldToLineSample(tgpt, tipt);
866  mapProj->worldToLineSample(bgpt, bipt);
867 
868  if(rect.clip(tipt, bipt))
869  {
870  ossimIpt rounded(bipt);
871  if( (rounded.x >= rect.ul().x)&&
872  (rounded.x <= rect.lr().x))
873  {
875  {
876  ossimDms dms(bgpt.lond(), false);
877 
880  dmsString);
883 // lonLabel->setFont(theGeographicBottomLabelFont->dup());
884 
885  lonLabel->computeBoundingRect();
886  ossimDrect boundsD;
887  lonLabel->getBoundingRect(boundsD);
888  ossimIrect bounds = boundsD;
889 
890  ossimIpt center( rounded.x,
891  ossim::round<int>(rect.lr().y+(bounds.height()/2)));
892 
894  lonLabel->setCenterPosition(center);
895  lonLabel->computeBoundingRect();
896  lonLabel->getBoundingRect(boundsD);
897  bounds = boundsD;
898 
899  ossimDrect labelRect;
900  lonLabel->getBoundingRect(labelRect);
901 
902  if(rect.intersects(labelRect))
903  {
904  ossimIrect intersection = rect.clipToRect(labelRect);
905  center.y += ossim::round<int>(rect.lr().y - intersection.ul().y);
906  }
907 
908  center.y += 24; // this will need to be the tick height later;
909  lonLabel->setCenterPosition(center);
910  lonLabel->computeBoundingRect();
911 
912 
913  addFixedAnnotation(lonLabel);
914  }
916  {
918  ossim::round<int>(rect.lr().y+24)),
919  ossimIpt(rounded.x,
920  ossim::round<int>(rect.lr().y)));
922  addFixedAnnotation(lineLabel);
923  }
924  }
925  }
926  }
927  }
928 }
929 
931 {
933  {
934  return;
935  }
936 
937  const ossimMapProjection* mapProj = inputMapProjection();
938  if(mapProj)
939  {
940  ossimGpt gpt[4];
941  ossimDrect rect = getViewingRect();
942 
943  if(rect.hasNans()) return;
944  mapProj->lineSampleToWorld(rect.ul(), gpt[0]);
945  mapProj->lineSampleToWorld(rect.ur(), gpt[1]);
946  mapProj->lineSampleToWorld(rect.lr(), gpt[2]);
947  mapProj->lineSampleToWorld(rect.ll(), gpt[3]);
948 
949  ossimDrect grect(gpt[0],
950  gpt[1],
951  gpt[2],
952  gpt[3],
954 
955  if(grect.hasNans()) return;
958 
961 
962  while(ulLatLon.lat > 90)
963  {
964  ulLatLon.lat -= theGeographicSpacing.lat;
965  }
966  while(ulLatLon.lon < -180)
967  {
968  ulLatLon.lon += theGeographicSpacing.lon;
969  }
970  while(lrLatLon.lat < -90)
971  {
972  ulLatLon.lat += theGeographicSpacing.lat;
973  }
974  while(lrLatLon.lon > 180)
975  {
976  ulLatLon.lon -= theGeographicSpacing.lon;
977  }
978 
979  ossimDrect latLonSpacing(ulLatLon,
980  lrLatLon,
982  // do the left side labels
983  for(double lat = latLonSpacing.ul().y; lat >= latLonSpacing.lr().y; lat-=theGeographicSpacing.y)
984  {
985  ossimDpt lipt;
986  ossimDpt ript;
987  ossimGpt lgpt(lat,
988  latLonSpacing.ul().x,
989  0.0,
990  gpt[0].datum());
991  ossimGpt rgpt(lat,
992  latLonSpacing.ur().x,
993  0.0,
994  gpt[0].datum());
995 
996 
997  mapProj->worldToLineSample(lgpt, lipt);
998  mapProj->worldToLineSample(rgpt, ript);
999  if(rect.clip(lipt, ript))
1000  {
1001  ossimIpt rounded(lipt);
1002  if( (rounded.y >= rect.ul().y)&&
1003  (rounded.y <= rect.lr().y))
1004  {
1006  {
1007  ossimDms dms(lgpt.latd());
1008 
1011  dmsString);
1013  latLabel->setFont(theGeographicLeftLabelFont.get());
1014 // latLabel->setFont(theGeographicLeftLabelFont->dup());
1015 
1016  latLabel->computeBoundingRect();
1017  ossimDrect boundsD;
1018  latLabel->getBoundingRect(boundsD);
1019  ossimIrect bounds = boundsD;
1020 
1021  ossimIpt center( ossim::round<int>((rect.ul().x - (bounds.width()/2))),
1022  rounded.y);
1023 
1025  latLabel->setCenterPosition(center);
1026  latLabel->computeBoundingRect();
1027  latLabel->getBoundingRect(boundsD);
1028  bounds = boundsD;
1029 
1030  ossimDrect labelRect;
1031  latLabel->getBoundingRect(labelRect);
1032 
1033  if(rect.intersects(labelRect))
1034  {
1035  ossimIrect intersection = rect.clipToRect(labelRect);
1036  center.x -= ossim::round<int>(rect.ul().x - intersection.ur().x);
1037  }
1038 
1039  center.x -= 24; // this will need to be the tick height later;
1040  latLabel->setCenterPosition(center);
1041  latLabel->computeBoundingRect();
1042 
1043 
1044 
1045  addFixedAnnotation(latLabel);
1046  }
1047 
1049  {
1050  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(rect.ul().x),
1051  rounded.y),
1052  ossimIpt(ossim::round<int>(rect.ul().x-23),
1053  rounded.y));
1055  addFixedAnnotation(lineLabel);
1056  }
1057  }
1058  }
1059  }
1060  }
1061 }
1062 
1064 {
1066  {
1067  return;
1068  }
1069 
1070  const ossimMapProjection* mapProj = inputMapProjection();
1071  if(mapProj)
1072  {
1073  ossimGpt gpt[4];
1074  ossimDrect rect = getViewingRect();
1075 
1076  if(rect.hasNans()) return;
1077  mapProj->lineSampleToWorld(rect.ul(), gpt[0]);
1078  mapProj->lineSampleToWorld(rect.ur(), gpt[1]);
1079  mapProj->lineSampleToWorld(rect.lr(), gpt[2]);
1080  mapProj->lineSampleToWorld(rect.ll(), gpt[3]);
1081 
1082  ossimDrect grect(gpt[0],
1083  gpt[1],
1084  gpt[2],
1085  gpt[3],
1087 
1088  if(grect.hasNans()) return;
1091 
1094 
1095  while(ulLatLon.lat > 90)
1096  {
1097  ulLatLon.lat -= theGeographicSpacing.lat;
1098  }
1099  while(ulLatLon.lon < -180)
1100  {
1101  ulLatLon.lon += theGeographicSpacing.lon;
1102  }
1103  while(lrLatLon.lat < -90)
1104  {
1105  ulLatLon.lat += theGeographicSpacing.lat;
1106  }
1107  while(lrLatLon.lon > 180)
1108  {
1109  ulLatLon.lon -= theGeographicSpacing.lon;
1110  }
1111 
1112  ossimDrect latLonSpacing(ulLatLon,
1113  lrLatLon,
1115  // do the left side labels
1116  for(double lat = latLonSpacing.ul().y; lat >= latLonSpacing.lr().y; lat-=theGeographicSpacing.y)
1117  {
1118  ossimDpt lipt;
1119  ossimDpt ript;
1120  ossimGpt lgpt(lat,
1121  latLonSpacing.ul().x,
1122  0.0,
1123  gpt[0].datum());
1124  ossimGpt rgpt(lat,
1125  latLonSpacing.ur().x,
1126  0.0,
1127  gpt[0].datum());
1128 
1129 
1130  mapProj->worldToLineSample(lgpt, lipt);
1131  mapProj->worldToLineSample(rgpt, ript);
1132 
1133  if(rect.clip(lipt, ript))
1134  {
1135  ossimIpt rounded(ript);
1136  if( (rounded.y >= rect.ul().y)&&
1137  (rounded.y <= rect.lr().y))
1138  {
1140  {
1141  ossimDms dms(rgpt.latd());
1142 
1145  dmsString);
1148 // latLabel->setFont(theGeographicRightLabelFont->dup());
1149  latLabel->computeBoundingRect();
1150  ossimDrect boundsD;
1151  latLabel->getBoundingRect(boundsD);
1152  ossimIrect bounds = boundsD;
1153 
1154  ossimIpt center( ossim::round<int>((rect.ur().x + (bounds.width()/2))),
1155  rounded.y);
1156 
1158  latLabel->setCenterPosition(center);
1159  latLabel->computeBoundingRect();
1160  latLabel->getBoundingRect(boundsD);
1161  bounds = boundsD;
1162 
1163  ossimDrect labelRect;
1164  latLabel->getBoundingRect(labelRect);
1165 
1166  if(rect.intersects(labelRect))
1167  {
1168  ossimIrect intersection = rect.clipToRect(labelRect);
1169  center.x -= ossim::round<int>(rect.ur().x - intersection.ul().x);
1170  }
1171 
1172  center.x += 24; // this will need to be the tick height later;
1173  latLabel->setCenterPosition(center);
1174  latLabel->computeBoundingRect();
1175 
1176 
1177  addFixedAnnotation(latLabel);
1178  }
1179 
1181  {
1182  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(rect.lr().x),
1183  rounded.y),
1184  ossimIpt(ossim::round<int>(rect.lr().x+23),
1185  rounded.y));
1186 
1188  addFixedAnnotation(lineLabel);
1189  }
1190  }
1191  }
1192  }
1193  }
1194 }
1195 
1197 {
1198  const ossimMapProjection* mapProj = inputMapProjection();
1199  if(mapProj)
1200  {
1201  ossimGpt gpt[4];
1202  ossimDrect rect = getViewingRect();
1203 
1204  if(rect.hasNans()) return;
1205  mapProj->lineSampleToWorld(rect.ul(), gpt[0]);
1206  mapProj->lineSampleToWorld(rect.ur(), gpt[1]);
1207  mapProj->lineSampleToWorld(rect.lr(), gpt[2]);
1208  mapProj->lineSampleToWorld(rect.ll(), gpt[3]);
1209 
1210  ossimDrect grect(gpt[0],
1211  gpt[1],
1212  gpt[2],
1213  gpt[3],
1215 
1216  if(grect.hasNans()) return;
1219 
1222 
1223  while(ulLatLon.lat > 90)
1224  {
1225  ulLatLon.lat -= theGeographicSpacing.lat;
1226  }
1227  while(ulLatLon.lon < -180)
1228  {
1229  ulLatLon.lon += theGeographicSpacing.lon;
1230  }
1231  while(lrLatLon.lat < -90)
1232  {
1233  ulLatLon.lat += theGeographicSpacing.lat;
1234  }
1235  while(lrLatLon.lon > 180)
1236  {
1237  ulLatLon.lon -= theGeographicSpacing.lon;
1238  }
1239 
1240  ossimDrect latLonSpacing(ulLatLon,
1241  lrLatLon,
1243 
1244 
1245  for(double lon = latLonSpacing.ul().x; lon <= latLonSpacing.lr().x; lon+=theGeographicSpacing.x)
1246  {
1247  ossimDpt tipt; // top
1248  ossimDpt bipt; // bottom
1249 
1250  ossimGpt tgpt(latLonSpacing.ul().y,
1251  lon,
1252  0.0,
1253  gpt[0].datum());
1254 
1255  ossimGpt bgpt(latLonSpacing.lr().y,
1256  lon,
1257  0.0,
1258  gpt[0].datum());
1259 
1260  mapProj->worldToLineSample(tgpt, tipt);
1261  mapProj->worldToLineSample(bgpt, bipt);
1262 
1263  if(rect.clip(tipt, bipt))
1264  {
1265  ossimAnnotationLineObject* line = new ossimAnnotationLineObject(tipt, bipt);
1269  addFixedAnnotation(line);
1270  }
1271  }
1272  // do the left side labels
1273  for(double lat = latLonSpacing.ul().y; lat >= latLonSpacing.lr().y; lat-=theGeographicSpacing.y)
1274  {
1275  ossimDpt lipt;
1276  ossimDpt ript;
1277  ossimGpt lgpt(lat,
1278  latLonSpacing.ul().x,
1279  0.0,
1280  gpt[0].datum());
1281  ossimGpt rgpt(lat,
1282  latLonSpacing.ur().x,
1283  0.0,
1284  gpt[0].datum());
1285 
1286  mapProj->worldToLineSample(lgpt, lipt);
1287  mapProj->worldToLineSample(rgpt, ript);
1288 
1289  if(rect.clip(lipt, ript))
1290  {
1292  ript);
1293 
1297 
1298  addFixedAnnotation(line);
1299  }
1300  }
1301  }
1302 }
1303 
1305 {
1306  const ossimMapProjection* mapProj = inputMapProjection();
1307  if(mapProj)
1308  {
1309  ossimGpt gptArray[4];
1310  ossimDrect rect = getViewingRect();
1311 
1312  mapProj->lineSampleToWorld(rect.ul(), gptArray[0]);
1313  mapProj->lineSampleToWorld(rect.ur(), gptArray[1]);
1314  mapProj->lineSampleToWorld(rect.lr(), gptArray[2]);
1315  mapProj->lineSampleToWorld(rect.ll(), gptArray[3]);
1316 
1317  ossimDrect grect(gptArray[0],
1318  gptArray[1],
1319  gptArray[2],
1320  gptArray[3],
1322 
1325 
1328 
1329  ossimDrect latLonSpacing(ulLatLon,
1330  lrLatLon,
1332 
1333  ossimDpt ipt; // top
1334  for(double lat = latLonSpacing.ul().y; lat >= latLonSpacing.lr().y; lat-=theGeographicSpacing.y)
1335  {
1336  for(double lon = latLonSpacing.ul().x; lon <= latLonSpacing.lr().x; lon+=theGeographicSpacing.x)
1337  {
1338 
1339  ossimGpt gpt(lat,
1340  lon,
1341  0.0,
1342  gptArray[0].datum());
1343 
1344  mapProj->worldToLineSample(gpt, ipt);
1345 
1346  ossimIpt rounded(ipt);
1347  if(rect.pointWithin(ossimDpt(rounded)))
1348  {
1349  ossimIpt horizontalStart(rounded.x-10, rounded.y);
1350  ossimIpt horizontalEnd(rounded.x+10, rounded.y);
1351 
1352  ossimIpt verticalStart(rounded.x, rounded.y-10);
1353  ossimIpt verticalEnd(rounded.x, rounded.y+10);
1354 
1355  ossimAnnotationLineObject* line1 = new ossimAnnotationLineObject(horizontalStart, horizontalEnd);
1356  ossimAnnotationLineObject* line2 = new ossimAnnotationLineObject(verticalStart,verticalEnd);
1357 
1364  addFixedAnnotation(line1);
1365  addFixedAnnotation(line2);
1366  }
1367  }
1368  }
1369  }
1370 }
1371 
1373 {
1374  const ossimMapProjection* mapProj = inputMapProjection();
1375  if(mapProj)
1376  {
1377  ossimDpt dptArray[4];
1378  ossimDrect rect = getViewingRect();
1379 
1380  mapProj->lineSampleToEastingNorthing(rect.ul(), dptArray[0]);
1381  mapProj->lineSampleToEastingNorthing(rect.ur(), dptArray[1]);
1382  mapProj->lineSampleToEastingNorthing(rect.lr(), dptArray[2]);
1383  mapProj->lineSampleToEastingNorthing(rect.ll(), dptArray[3]);
1384 
1385  ossimDrect drect(dptArray[0], dptArray[1], dptArray[2], dptArray[3], OSSIM_RIGHT_HANDED);
1386 
1387  ossimDpt ulMeter(((int)((drect.ul().x-theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1388  ((int)((drect.ul().y+theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1389 
1390  ossimDpt lrMeter(((int)((drect.lr().x+theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1391  ((int)((drect.lr().y-theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1392 
1393  ossimDrect meterSpacing(ulMeter,
1394  lrMeter,
1396 
1397  for(double horizontal = meterSpacing.ul().x;
1398  horizontal <= meterSpacing.lr().x;
1399  horizontal+=theMeterSpacing.x)
1400  {
1401  ossimDpt tipt; // top
1402  ossimDpt bipt; // bottom
1403 
1404  ossimDpt tdpt(horizontal, meterSpacing.ul().y);
1405 
1406  ossimDpt bdpt(horizontal, meterSpacing.lr().y);
1407 
1408  mapProj->eastingNorthingToLineSample(tdpt, tipt);
1409  mapProj->eastingNorthingToLineSample(bdpt, bipt);
1410 
1411  if(rect.clip(tipt, bipt))
1412  {
1413  ossimAnnotationLineObject* line = new ossimAnnotationLineObject(tipt, bipt);
1417  addFixedAnnotation(line);
1418  }
1419  }
1420  // do the left side labels
1421  for(double vertical = meterSpacing.ul().y;
1422  vertical >= meterSpacing.lr().y;
1423  vertical-=theMeterSpacing.y)
1424  {
1425  ossimDpt lipt;
1426  ossimDpt ript;
1427  ossimDpt ldpt(meterSpacing.ul().x, vertical);
1428  ossimDpt rdpt(meterSpacing.ur().x, vertical);
1429 
1430  mapProj->eastingNorthingToLineSample(ldpt, lipt);
1431  mapProj->eastingNorthingToLineSample(rdpt, ript);
1432 
1433  if(rect.clip(lipt, ript))
1434  {
1435  ossimAnnotationLineObject* line = new ossimAnnotationLineObject(lipt, ript);
1436 
1440 
1441  addFixedAnnotation(line);
1442  }
1443  }
1444  }
1445 }
1446 
1448 {
1449  const ossimMapProjection* mapProj = inputMapProjection();
1450  if(mapProj)
1451  {
1452  ossimDpt dptArray[4];
1453  ossimDrect rect = getViewingRect();
1454 
1455  mapProj->lineSampleToEastingNorthing(rect.ul(), dptArray[0]);
1456  mapProj->lineSampleToEastingNorthing(rect.ur(), dptArray[1]);
1457  mapProj->lineSampleToEastingNorthing(rect.lr(), dptArray[2]);
1458  mapProj->lineSampleToEastingNorthing(rect.ll(), dptArray[3]);
1459 
1460  ossimDrect drect(dptArray[0],
1461  dptArray[1],
1462  dptArray[2],
1463  dptArray[3],
1465 
1466  ossimDpt ulMeter(((int)((drect.ul().x-theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1467  ((int)((drect.ul().y+theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1468 
1469  ossimDpt lrMeter(((int)((drect.lr().x+theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1470  ((int)((drect.lr().y-theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1471 
1472  ossimDrect meterSpacing(ulMeter,
1473  lrMeter,
1475 
1476  ossimDrect labelRect;
1477 
1478  // Since we support overlapping grid lables. We will shift
1479  // the meter label if there exists a gegraphic label. To
1480  // do this we need to compute an extra shift length based
1481  // on the font type on each of the sides. We could actually make this
1482  // shift adjustable later????
1483  //
1484  long extraTopDelta = 0;
1485  long extraBottomDelta = 0;
1486  long extraLeftDelta = 0;
1487  long extraRightDelta = 0;
1488 
1490  {
1491  ossimDms dms(180, false);
1492  ossimString dmsString = dms.toString(theTopGeographicFormat.c_str());
1493 
1495  ossimIrect box;
1496 
1498  extraTopDelta = box.height();
1499  }
1501  {
1502  ossimDms dms(180, false);
1505  ossimIrect box;
1506 
1508  extraBottomDelta = box.height();
1509  }
1511  {
1512  ossimDms dms(90.0, true);
1515  ossimIrect box;
1516 
1518  extraLeftDelta = box.width();
1519  }
1521  {
1522  ossimDms dms(90.0, true);
1524 
1526  ossimIrect box;
1527 
1529  extraRightDelta = box.width();
1530  }
1531 
1533  {
1534  for(double horizontal = meterSpacing.ul().x;
1535  horizontal <= meterSpacing.lr().x;
1536  horizontal+=theMeterSpacing.x)
1537  {
1538  ossimDpt tipt; // top
1539  ossimDpt bipt; // bottom
1540 
1541  ossimDpt tdpt(horizontal,
1542  meterSpacing.ul().y);
1543 
1544  ossimDpt bdpt(horizontal,
1545  meterSpacing.lr().y);
1546 
1547  mapProj->eastingNorthingToLineSample(tdpt, tipt);
1548  mapProj->eastingNorthingToLineSample(bdpt, bipt);
1549 
1550  rect.clip(tipt, bipt);
1551 
1552  tipt = ossimIpt(tipt);
1553  bipt = ossimIpt(bipt);
1554 
1555  if(theTopMeterLabelFlag&&rect.clip(tipt, bipt))
1556  {
1558  ossimString::toString(horizontal).c_str());
1559 
1560 
1561  topLabel->setFont(theMeterTopLabelFont.get());
1562 
1564  topLabel->computeBoundingRect();
1565  ossimDrect boundsTop;
1566  topLabel->getBoundingRect(boundsTop);
1567 
1568  ossimIpt centerTop(ossim::round<int>(tipt.x),
1569  ossim::round<int>(rect.ul().y-(boundsTop.height()/2)));
1570 
1571  topLabel->setColor(theTopMeterLabelColor.getR(),
1574 
1575 
1576  topLabel->setCenterPosition(centerTop);
1577  topLabel->computeBoundingRect();
1578 
1579  topLabel->getBoundingRect(labelRect);
1580 
1581  if(rect.intersects(labelRect))
1582  {
1583  ossimIrect intersection = rect.clipToRect(labelRect);
1584  centerTop.y -= ossim::round<int>(rect.ul().y - intersection.lr().y);
1585  }
1586 
1587  centerTop.y -= (24+extraTopDelta); // this will need to be the tick height later;
1588  topLabel->setCenterPosition(centerTop);
1589  topLabel->computeBoundingRect();
1590  addFixedAnnotation(topLabel);
1591 
1593  {
1594  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(tipt.x),
1595  ossim::round<int>(tipt.y-24)),
1596  ossimIpt(ossim::round<int>(tipt.x),
1597  ossim::round<int>(tipt.y)));
1598 
1600  addFixedAnnotation(lineLabel);
1601  }
1602  }
1603  // ------------------------- BOTTOM ----------------------------
1604 
1605  if(theBottomMeterLabelFlag&&rect.pointWithin(bipt))
1606  {
1608  ossimString::toString(horizontal).c_str());
1609 
1610 
1611  bottomLabel->setFont(theMeterBottomLabelFont.get());
1612 
1614  bottomLabel->computeBoundingRect();
1615  ossimDrect boundsBottom;
1616  bottomLabel->getBoundingRect(boundsBottom);
1617 
1618  ossimIpt centerBottom(ossim::round<int>(bipt.x),
1619  ossim::round<int>(rect.lr().y+(boundsBottom.height()/2)));
1620 
1621  bottomLabel->setColor(theBottomMeterLabelColor.getR(),
1624 
1625 
1626  bottomLabel->setCenterPosition(centerBottom);
1627  bottomLabel->computeBoundingRect();
1628 
1629  bottomLabel->getBoundingRect(labelRect);
1630 
1631  if(rect.intersects(labelRect))
1632  {
1633  ossimIrect intersection = rect.clipToRect(labelRect);
1634  centerBottom.y += ossim::round<int>(rect.lr().y - intersection.ul().y);
1635  }
1636 
1637  centerBottom.y += (24+extraBottomDelta); // this will need to be the tick height later;
1638  bottomLabel->setCenterPosition(centerBottom);
1639  bottomLabel->computeBoundingRect();
1640  addFixedAnnotation(bottomLabel);
1642  {
1643  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(bipt.x),
1644  ossim::round<int>(bipt.y+24)),
1645  ossimIpt(ossim::round<int>(bipt.x),
1646  ossim::round<int>(bipt.y)));
1647 
1649  addFixedAnnotation(lineLabel);
1650  }
1651  }
1652  }
1653  }
1655  {
1656  for(double vertical = meterSpacing.ul().y;
1657  vertical >= meterSpacing.lr().y;
1658  vertical-=theMeterSpacing.y)
1659  {
1660  ossimDpt lipt;
1661  ossimDpt ript;
1662  ossimDpt ldpt(meterSpacing.ul().x,
1663  vertical);
1664  ossimDpt rdpt(meterSpacing.ur().x,
1665  vertical);
1666 
1667  mapProj->eastingNorthingToLineSample(ldpt, lipt);
1668  mapProj->eastingNorthingToLineSample(rdpt, ript);
1669 
1670  if(rect.clip(lipt, ript))
1671  {
1672  //------------------------------------------------ Left label ----------------------------------------------
1674  ossimString::toString(vertical).c_str());
1675 
1676 
1677  leftLabel->setFont(theMeterLeftLabelFont.get());
1678 
1680  leftLabel->computeBoundingRect();
1681  ossimDrect boundsLeft;
1682  leftLabel->getBoundingRect(boundsLeft);
1683 
1684  ossimIpt centerLeft(ossim::round<int>(rect.ul().x-(boundsLeft.width()/2)),
1685  ossim::round<int>(lipt.y));
1686 
1687 
1688  leftLabel->setColor(theLeftMeterLabelColor.getR(),
1691 
1692 
1693  leftLabel->setCenterPosition(centerLeft);
1694  leftLabel->computeBoundingRect();
1695 
1696  leftLabel->getBoundingRect(labelRect);
1697 
1698  if(rect.intersects(labelRect))
1699  {
1700  ossimIrect intersection = rect.clipToRect(labelRect);
1701  centerLeft.x -= ossim::round<int>(intersection.lr().x - rect.ul().x);
1702  }
1703 
1704  centerLeft.x -= (24+extraLeftDelta); // this will need to be the tick height later;
1705  leftLabel->setCenterPosition(centerLeft);
1706  leftLabel->computeBoundingRect();
1707  addFixedAnnotation(leftLabel);
1709  {
1710  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(lipt.x-24),
1711  ossim::round<int>(lipt.y)),
1712  ossimIpt(ossim::round<int>(lipt.x),
1713  ossim::round<int>(lipt.y)));
1714 
1716  addFixedAnnotation(lineLabel);
1717  }
1718 
1719 
1720  //--------------------------------RIGHT-----------------------------------------------------------
1722  ossimString::toString(vertical).c_str());
1723 
1724 
1725  rightLabel->setFont(theMeterRightLabelFont.get());
1726 
1728  rightLabel->computeBoundingRect();
1729  ossimDrect boundsRight;
1730  rightLabel->getBoundingRect(boundsRight);
1731 
1732  ossimIpt centerRight(ossim::round<int>(rect.ur().x+(boundsRight.width()/2)),
1733  ossim::round<int>(ript.y));
1734 
1735 
1736  rightLabel->setColor(theRightMeterLabelColor.getR(),
1739 
1740 
1741  rightLabel->setCenterPosition(centerRight);
1742  rightLabel->computeBoundingRect();
1743 
1744  rightLabel->getBoundingRect(labelRect);
1745 
1746  if(rect.intersects(labelRect))
1747  {
1748  ossimIrect intersection = rect.clipToRect(labelRect);
1749  centerRight.x += ossim::round<int>(intersection.ul().x - rect.ur().x);
1750  }
1751 
1752  centerRight.x += (24+extraRightDelta); // this will need to be the tick height later;
1753  rightLabel->setCenterPosition(centerRight);
1754  rightLabel->computeBoundingRect();
1755  addFixedAnnotation(rightLabel);
1757  {
1758  ossimAnnotationLineObject* lineLabel = new ossimAnnotationLineObject(ossimIpt(ossim::round<int>(ript.x+24),
1759  ossim::round<int>(ript.y)),
1760  ossimIpt(ossim::round<int>(ript.x),
1761  ossim::round<int>(ript.y)));
1762 
1764  addFixedAnnotation(lineLabel);
1765  }
1766  }
1767  }
1768  }
1769  }
1770 }
1771 
1772 
1774 {
1775  const ossimMapProjection* mapProj = inputMapProjection();
1776  if(mapProj)
1777  {
1778  ossimDpt dpt[4];
1779  ossimDrect rect = getViewingRect();
1780 
1781  mapProj->lineSampleToEastingNorthing(rect.ul(), dpt[0]);
1782  mapProj->lineSampleToEastingNorthing(rect.ur(), dpt[1]);
1783  mapProj->lineSampleToEastingNorthing(rect.lr(), dpt[2]);
1784  mapProj->lineSampleToEastingNorthing(rect.ll(), dpt[3]);
1785 
1786  ossimDrect drect(dpt[0],
1787  dpt[1],
1788  dpt[2],
1789  dpt[3],
1791 
1792  ossimDpt ulMeter(((int)((drect.ul().x-theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1793  ((int)((drect.ul().y+theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1794 
1795  ossimDpt lrMeter(((int)((drect.lr().x+theMeterSpacing.x)/theMeterSpacing.x))*theMeterSpacing.x,
1796  ((int)((drect.lr().y-theMeterSpacing.y)/theMeterSpacing.y))*theMeterSpacing.y);
1797 
1798  ossimDrect meterSpacing(ulMeter,
1799  lrMeter,
1801 
1802  ossimDpt ipt; // top
1803 
1804  for(double vertical = meterSpacing.ul().y; vertical >= meterSpacing.lr().y; vertical-=theMeterSpacing.y)
1805  {
1806  for(double horizontal = meterSpacing.ul().x; horizontal <= meterSpacing.lr().x; horizontal+=theMeterSpacing.x)
1807  {
1808  ossimDpt dpt(horizontal,
1809  vertical);
1810 
1811  mapProj->eastingNorthingToLineSample(dpt, ipt);
1812 
1813  ossimIpt rounded(ipt);
1814  if(rect.pointWithin(ossimDpt(rounded)))
1815  {
1816  ossimIpt horizontalStart(rounded.x-10, rounded.y);
1817  ossimIpt horizontalEnd(rounded.x+10, rounded.y);
1818 
1819  ossimIpt verticalStart(rounded.x, rounded.y-10);
1820  ossimIpt verticalEnd(rounded.x, rounded.y+10);
1821 
1822  ossimAnnotationLineObject* line1 = new ossimAnnotationLineObject(horizontalStart, horizontalEnd);
1823  ossimAnnotationLineObject* line2 = new ossimAnnotationLineObject(verticalStart,verticalEnd);
1824 
1825  line1->setColor(theMeterGridColor.getR(),
1828 
1829  line2->setColor(theMeterGridColor.getR(),
1832  addFixedAnnotation(line1);
1833  addFixedAnnotation(line2);
1834  }
1835  }
1836  }
1837  }
1838 }
1839 
1841 {
1843  theTitleString);
1845  title->setFont(theTitleFont.get());
1846  title->setColor(theTitleColor.getR(),
1847  theTitleColor.getG(),
1848  theTitleColor.getB());
1850  title->computeBoundingRect();
1851 
1852  addFixedAnnotation(title);
1853 }
1854 
1856 {
1857  ossimIrect result;
1858  result.makeNan();
1859 
1860  if(theInputConnection)
1861  {
1862  result = theInputConnection->getBoundingRect();
1863 
1864  if(!result.hasNans())
1865  {
1866  ossimIpt mid = result.midPoint();
1867  ossim_int32 w = result.width();
1868  ossim_int32 h = result.width();
1869 
1870  if(theViewWidthHeight.x >-1)
1871  {
1872  w = theViewWidthHeight.x;
1873  }
1874  if(theViewWidthHeight.y >-1)
1875  {
1876  h = theViewWidthHeight.y;
1877  }
1878  ossimIpt ul(mid.x - w/2,
1879  mid.y - h/2);
1880 
1881  result = ossimIrect(ul.x,
1882  ul.y,
1883  ul.x + w-1,
1884  ul.y + h -1);
1885  }
1886  }
1887 
1888  return result;
1889 }
1890 
1893 {
1894  if (!theImage)
1895  {
1896  return;
1897  }
1898 
1900 
1901  if(theImage->getImageData().valid())
1902  {
1903  ossimAnnotationSource::AnnotationObjectListType::iterator object = theFixedAnnotationList.begin();
1904  while(object != theFixedAnnotationList.end())
1905  {
1906  if((*object).valid())
1907  {
1908  (*object)->draw(*theImage);
1909  }
1910  ++object;
1911  }
1912  }
1913 
1915 }
1916 
1918 {
1919  theFixedAnnotationList.clear();
1920 }
1921 
1922 
1924 {
1925  if(!property.valid()) return;
1926 
1927  ossimRefPtr<ossimProperty> tempProp = 0;
1928  ossimFontProperty* fontProp = 0;
1929  ossimColorProperty* colorProp = 0;
1930  ossimBooleanProperty* booleanProp = 0;
1931 
1932  if(property->getName() == "Geographic label properties")
1933  {
1935  property.get());
1936  if(containerProp)
1937  {
1938  // first set the font format
1939  //
1940  tempProp = containerProp->getProperty("Top font");
1941  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
1942  if(fontProp)
1943  {
1945  }
1946  tempProp = containerProp->getProperty("Bottom font");
1947  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
1948  if(fontProp)
1949  {
1951  }
1952  tempProp = containerProp->getProperty("Left font");
1953  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
1954  if(fontProp)
1955  {
1957  }
1958  tempProp = containerProp->getProperty("Right font");
1959  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
1960  if(fontProp)
1961  {
1963  }
1964 
1965  // set color property
1966  tempProp = containerProp->getProperty("Top color");
1967  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
1968  if(colorProp)
1969  {
1970  setTopGeographicLabelColor(colorProp->getColor());
1971  }
1972  tempProp = containerProp->getProperty("Bottom color");
1973  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
1974  if(colorProp)
1975  {
1977  }
1978  tempProp = containerProp->getProperty("Left color");
1979  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
1980  if(colorProp)
1981  {
1982  setLeftGeographicLabelColor(colorProp->getColor());
1983  }
1984  tempProp = containerProp->getProperty("Right color");
1985  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
1986  if(colorProp)
1987  {
1988  setRightGeographicLabelColor(colorProp->getColor());
1989  }
1990 
1991  // set enable flags
1992  tempProp = containerProp->getProperty("Top enabled");
1993  booleanProp = PTR_CAST(ossimBooleanProperty,
1994  tempProp.get());
1995  if(booleanProp)
1996  {
1997  setTopGeographicLabelFlag(booleanProp->getBoolean());
1998  }
1999 
2000  tempProp = containerProp->getProperty("Bottom enabled");
2001  booleanProp = PTR_CAST(ossimBooleanProperty,
2002  tempProp.get());
2003  if(booleanProp)
2004  {
2005  setBottomGeographicLabelFlag(booleanProp->getBoolean());
2006  }
2007 
2008  tempProp = containerProp->getProperty("Left enabled");
2009  booleanProp = PTR_CAST(ossimBooleanProperty,
2010  tempProp.get());
2011  if(booleanProp)
2012  {
2013  setLeftGeographicLabelFlag(booleanProp->getBoolean());
2014  }
2015 
2016  tempProp = containerProp->getProperty("Right enabled");
2017  booleanProp = PTR_CAST(ossimBooleanProperty,
2018  tempProp.get());
2019  if(booleanProp)
2020  {
2021  setRightGeographicLabelFlag(booleanProp->getBoolean());
2022  }
2023 
2024  tempProp = containerProp->getProperty("Top tick enabled");
2025  booleanProp = PTR_CAST(ossimBooleanProperty,
2026  tempProp.get());
2027  if(booleanProp)
2028  {
2029  setTopGeographicTickMarkFlag(booleanProp->getBoolean());
2030  }
2031  tempProp = containerProp->getProperty("Bottom tick enabled");
2032  booleanProp = PTR_CAST(ossimBooleanProperty,
2033  tempProp.get());
2034  if(booleanProp)
2035  {
2037  }
2038  tempProp = containerProp->getProperty("Left tick enabled");
2039  booleanProp = PTR_CAST(ossimBooleanProperty,
2040  tempProp.get());
2041  if(booleanProp)
2042  {
2043  setLeftGeographicTickMarkFlag(booleanProp->getBoolean());
2044  }
2045  tempProp = containerProp->getProperty("Right tick enabled");
2046  booleanProp = PTR_CAST(ossimBooleanProperty,
2047  tempProp.get());
2048  if(booleanProp)
2049  {
2051  }
2052  }
2053  }
2054  else if(property->getName() == "Geographic grid properties")
2055  {
2057  property.get());
2058  if(containerProp)
2059  {
2060  tempProp = containerProp->getProperty("Grid type");
2061  if(tempProp.valid())
2062  {
2063  ossimString value = tempProp->valueToString();
2064 
2065  if(value == "none")
2066  {
2068  }
2069  else if(value == "line")
2070  {
2072  }
2073  else if(value == "reseaux")
2074  {
2076  }
2077  }
2078  tempProp = containerProp->getProperty("Horizontal spacing");
2079  if(tempProp.valid())
2080  {
2081  setGeographicSpacingLon(tempProp->valueToString().toDouble());
2082  }
2083 
2084  tempProp = containerProp->getProperty("Vertical spacing");
2085  if(tempProp.valid())
2086  {
2087  setGeographicSpacingLat(tempProp->valueToString().toDouble());
2088  }
2089 
2090  tempProp = containerProp->getProperty("Color");
2091  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2092  if(tempProp.valid())
2093  {
2094  setGeographicGridColor(colorProp->getColor());
2095  }
2096  }
2097  }
2098  else if(property->getName() == "Meter label properties")
2099  {
2101  property.get());
2102  if(containerProp)
2103  {
2104  // first set the font format
2105  //
2106  tempProp = containerProp->getProperty("Top font");
2107  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
2108  if(fontProp)
2109  {
2111  }
2112  tempProp = containerProp->getProperty("Bottom font");
2113  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
2114  if(fontProp)
2115  {
2117  }
2118  tempProp = containerProp->getProperty("Left font");
2119  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
2120  if(fontProp)
2121  {
2123  }
2124  tempProp = containerProp->getProperty("Right font");
2125  fontProp = PTR_CAST(ossimFontProperty, tempProp.get());
2126  if(fontProp)
2127  {
2129  }
2130 
2131  // set color property
2132  tempProp = containerProp->getProperty("Top color");
2133  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2134  if(colorProp)
2135  {
2136  setTopMeterLabelColor(colorProp->getColor());
2137  }
2138  tempProp = containerProp->getProperty("Bottom color");
2139  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2140  if(colorProp)
2141  {
2142  setBottomMeterLabelColor(colorProp->getColor());
2143  }
2144  tempProp = containerProp->getProperty("Left color");
2145  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2146  if(colorProp)
2147  {
2148  setLeftMeterLabelColor(colorProp->getColor());
2149  }
2150  tempProp = containerProp->getProperty("Right color");
2151  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2152  if(colorProp)
2153  {
2154  setRightMeterLabelColor(colorProp->getColor());
2155  }
2156 
2157  // set enable flags
2158  tempProp = containerProp->getProperty("Top enabled");
2159  booleanProp = PTR_CAST(ossimBooleanProperty,
2160  tempProp.get());
2161  if(booleanProp)
2162  {
2163  setTopMeterLabelFlag(booleanProp->getBoolean());
2164  }
2165 
2166  tempProp = containerProp->getProperty("Bottom enabled");
2167  booleanProp = PTR_CAST(ossimBooleanProperty,
2168  tempProp.get());
2169  if(booleanProp)
2170  {
2171  setBottomMeterLabelFlag(booleanProp->getBoolean());
2172  }
2173 
2174  tempProp = containerProp->getProperty("Left enabled");
2175  booleanProp = PTR_CAST(ossimBooleanProperty,
2176  tempProp.get());
2177  if(booleanProp)
2178  {
2179  setLeftMeterLabelFlag(booleanProp->getBoolean());
2180  }
2181 
2182  tempProp = containerProp->getProperty("Right enabled");
2183  booleanProp = PTR_CAST(ossimBooleanProperty,
2184  tempProp.get());
2185  if(booleanProp)
2186  {
2187  setRightMeterLabelFlag(booleanProp->getBoolean());
2188  }
2189 
2190  tempProp = containerProp->getProperty("Top tick enabled");
2191  booleanProp = PTR_CAST(ossimBooleanProperty,
2192  tempProp.get());
2193  if(booleanProp)
2194  {
2195  setTopMeterTickMarkFlag(booleanProp->getBoolean());
2196  }
2197  tempProp = containerProp->getProperty("Bottom tick enabled");
2198  booleanProp = PTR_CAST(ossimBooleanProperty,
2199  tempProp.get());
2200  if(booleanProp)
2201  {
2202  setBottomMeterTickMarkFlag(booleanProp->getBoolean());
2203  }
2204  tempProp = containerProp->getProperty("Left tick enabled");
2205  booleanProp = PTR_CAST(ossimBooleanProperty,
2206  tempProp.get());
2207  if(booleanProp)
2208  {
2209  setLeftMeterTickMarkFlag(booleanProp->getBoolean());
2210  }
2211  tempProp = containerProp->getProperty("Right tick enabled");
2212  booleanProp = PTR_CAST(ossimBooleanProperty,
2213  tempProp.get());
2214  if(booleanProp)
2215  {
2216  setRightMeterTickMarkFlag(booleanProp->getBoolean());
2217  }
2218  }
2219  }
2220  else if(property->getName() == "Meter grid properties")
2221  {
2223  property.get());
2224  if(containerProp)
2225  {
2226  tempProp = containerProp->getProperty("Grid type");
2227  if(tempProp.valid())
2228  {
2229  ossimString value = tempProp->valueToString();
2230 
2231  if(value == "none")
2232  {
2234  }
2235  else if(value == "line")
2236  {
2238  }
2239  else if(value == "reseaux")
2240  {
2242  }
2243  }
2244  tempProp = containerProp->getProperty("Horizontal spacing");
2245  if(tempProp.valid())
2246  {
2247  setMeterSpacingX(tempProp->valueToString().toDouble());
2248  }
2249 
2250  tempProp = containerProp->getProperty("Vertical spacing");
2251  if(tempProp.valid())
2252  {
2253  setMeterSpacingY(tempProp->valueToString().toDouble());
2254  }
2255 
2256  tempProp = containerProp->getProperty("Color");
2257  colorProp = PTR_CAST(ossimColorProperty, tempProp.get());
2258  if(tempProp.valid())
2259  {
2260  setMeterGridColor(colorProp->getColor());
2261  }
2262  }
2263  }
2264  else if(property->getName() == "Title properties")
2265  {
2267  property.get());
2268  if(container)
2269  {
2270  ossimProperty* titleProp = container->getProperty("Title").get();
2271  if(titleProp)
2272  {
2273  setTitle(titleProp->valueToString());
2274  }
2276  container->getProperty("Font").get());
2278  container->getProperty("Color").get());
2279 
2280  if(fontProp)
2281  {
2282  setTitleFont(fontProp->getFontInformation());
2283  }
2284  if(colorProp)
2285  {
2286  setTitleColor(colorProp->getColor());
2287  }
2288  }
2289  }
2290  else if(property->getName() == "Viewport properties")
2291  {
2293  property.get());
2294  if(container)
2295  {
2296  int w = -1;
2297  int h = -1;
2298  tempProp = container->getProperty("Width");
2299  if(tempProp.valid())
2300  {
2301  w = tempProp->valueToString().toInt32();
2302  }
2303  tempProp = container->getProperty("Height");
2304  if(tempProp.valid())
2305  {
2306  h = tempProp->valueToString().toInt32();
2307  }
2309  }
2310  }
2311  else if(property->getName() == "Border color")
2312  {
2313  colorProp = PTR_CAST(ossimColorProperty,
2314  property.get());
2315  if(colorProp)
2316  {
2317  setBorderColor(colorProp->getColor());
2318  }
2319  }
2320  else if(property->getName() == "Border size")
2321  {
2323  property.get());
2324  if(container)
2325  {
2326  tempProp = container->getProperty("Top");
2327  if(tempProp.valid())
2328  {
2329  setTopBorderLength(tempProp->valueToString().toInt32());
2330 
2331  }
2332  tempProp = container->getProperty("Bottom");
2333  if(tempProp.valid())
2334  {
2335  setBottomBorderLength(tempProp->valueToString().toInt32());
2336 
2337  }
2338  tempProp = container->getProperty("Left");
2339  if(tempProp.valid())
2340  {
2341  setLeftBorderLength(tempProp->valueToString().toInt32());
2342 
2343  }
2344  tempProp = container->getProperty("Right");
2345  if(tempProp.valid())
2346  {
2347  setRightBorderLength(tempProp->valueToString().toInt32());
2348  }
2349  }
2350  }
2351  else
2352  {
2354  }
2355 }
2356 
2358 {
2359  if(name == "Viewport properties")
2360  {
2361  ossimContainerProperty* container = new ossimContainerProperty(name);
2362 
2363  container->addChild(new ossimNumericProperty("Width",
2365  -1,1.0/DBL_EPSILON));
2366  container->addChild(new ossimNumericProperty("Height",
2368  -1,1.0/DBL_EPSILON));
2369  container->setCacheRefreshBit();
2370  return container;
2371  }
2372  else if(name == "Geographic label properties")
2373  {
2374 
2375  ossimContainerProperty* container = new ossimContainerProperty(name);
2376 
2377  container->addChild(new ossimFontProperty("Top font",
2379  container->addChild(new ossimColorProperty("Top color",
2381  container->addChild(new ossimBooleanProperty("Top enabled",
2383  container->addChild(new ossimBooleanProperty("Top tick enabled",
2385 
2386  container->addChild(new ossimFontProperty("Bottom font",
2388  container->addChild(new ossimColorProperty("Bottom color",
2390  container->addChild(new ossimBooleanProperty("Bottom enabled",
2392  container->addChild(new ossimBooleanProperty("Bottom tick enabled",
2394 
2395  container->addChild(new ossimFontProperty("Left font",
2397  container->addChild(new ossimColorProperty("Left color",
2399  container->addChild(new ossimBooleanProperty("Left enabled",
2401  container->addChild(new ossimBooleanProperty("Left tick enabled",
2403 
2404  container->addChild(new ossimFontProperty("Right font",
2406  container->addChild(new ossimColorProperty("Right color",
2408  container->addChild(new ossimBooleanProperty("Right enabled",
2410  container->addChild(new ossimBooleanProperty("Right tick enabled",
2412  container->setCacheRefreshBit();
2413  return container;
2414  }
2415  else if(name == "Geographic grid properties")
2416  {
2417  ossimContainerProperty* container = new ossimContainerProperty(name);
2418  std::vector<ossimString> gridTypeConstraints;
2419  ossimString value = GRID_TYPE_ENUM_NAMES[(int)theGeographicGridType];
2420 
2421  gridTypeConstraints.push_back("none");
2422  gridTypeConstraints.push_back("line");
2423  gridTypeConstraints.push_back("reseaux");
2424 
2425  container->addChild(new ossimStringProperty("Grid type",
2426  value,
2427  false,
2428  gridTypeConstraints));
2429  container->addChild(new ossimColorProperty("Color",
2431 
2432  container->addChild(new ossimNumericProperty("Horizontal spacing",
2434  0.0, 180.0));
2435 
2436  container->addChild(new ossimNumericProperty("Vertical spacing",
2438  0.0, 180.0));
2439 
2440  container->setCacheRefreshBit();
2441  return container;
2442  }
2443  else if(name == "Meter label properties")
2444  {
2445  ossimContainerProperty* container = new ossimContainerProperty(name);
2446 
2447  container->addChild(new ossimFontProperty("Top font",
2449  container->addChild(new ossimColorProperty("Top color",
2451  container->addChild(new ossimBooleanProperty("Top enabled",
2453  container->addChild(new ossimBooleanProperty("Top tick enabled",
2455 
2456  container->addChild(new ossimFontProperty("Bottom font",
2458  container->addChild(new ossimColorProperty("Bottom color",
2460  container->addChild(new ossimBooleanProperty("Bottom enabled",
2462  container->addChild(new ossimBooleanProperty("Bottom tick enabled",
2464 
2465  container->addChild(new ossimFontProperty("Left font",
2467  container->addChild(new ossimColorProperty("Left color",
2469  container->addChild(new ossimBooleanProperty("Left enabled",
2471  container->addChild(new ossimBooleanProperty("Left tick enabled",
2473 
2474  container->addChild(new ossimFontProperty("Right font",
2476  container->addChild(new ossimColorProperty("Right color",
2478  container->addChild(new ossimBooleanProperty("Right enabled",
2480  container->addChild(new ossimBooleanProperty("Right tick enabled",
2482 
2483  container->setCacheRefreshBit();
2484  return container;
2485  }
2486  else if(name == "Meter grid properties")
2487  {
2488  ossimContainerProperty* container = new ossimContainerProperty(name);
2489  std::vector<ossimString> gridTypeConstraints;
2490  ossimString value = GRID_TYPE_ENUM_NAMES[(int)theMeterGridType];
2491 
2492  gridTypeConstraints.push_back("none");
2493  gridTypeConstraints.push_back("line");
2494  gridTypeConstraints.push_back("reseaux");
2495 
2496  container->addChild(new ossimStringProperty("Grid type",
2497  value,
2498  false,
2499  gridTypeConstraints));
2500  container->addChild(new ossimColorProperty("Color",
2502 
2503  container->addChild(new ossimNumericProperty("Horizontal spacing",
2505  0.0, 1.0/DBL_EPSILON));
2506 
2507  container->addChild(new ossimNumericProperty("Vertical spacing",
2509  0.0, 1.0/DBL_EPSILON));
2510  container->setCacheRefreshBit();
2511  return container;
2512  }
2513  else if(name == "Title properties")
2514  {
2515  ossimContainerProperty* container = new ossimContainerProperty(name);
2516  container->addChild(new ossimTextProperty("Title",
2517  theTitleString));
2518  container->addChild(new ossimFontProperty("Font",
2519  theTitleFontInfo));
2520  container->addChild(new ossimColorProperty("Color",
2521  theTitleColor));
2522 
2523  container->setCacheRefreshBit();
2524  return container;
2525  }
2526  else if(name == "Border size")
2527  {
2528  ossimContainerProperty* container = new ossimContainerProperty(name);
2529 
2530  container->addChild(new ossimNumericProperty("Top",
2532  0,10000));
2533  container->addChild(new ossimNumericProperty("Bottom",
2535  0,10000));
2536  container->addChild(new ossimNumericProperty("Left",
2538  0,10000));
2539  container->addChild(new ossimNumericProperty("Right",
2541  0,10000));
2542  container->setCacheRefreshBit();
2543  return container;
2544  }
2545  else if(name == "Border color")
2546  {
2547  ossimColorProperty* colorProp = new ossimColorProperty(name,
2548  theBorderColor);
2549  colorProp->setCacheRefreshBit();
2550 
2551  return colorProp;
2552  }
2553  else if(name == "Viewport properties")
2554  {
2555 
2556  }
2558 }
2559 
2560 void ossimMapCompositionSource::getPropertyNames(std::vector<ossimString>& propertyNames)const
2561 {
2563 
2564 
2565  propertyNames.push_back("Title properties");
2566  propertyNames.push_back("Border size");
2567  propertyNames.push_back("Border color");
2568  propertyNames.push_back("Viewport properties");
2569  propertyNames.push_back("Geographic label properties");
2570  propertyNames.push_back("Geographic grid properties");
2571  propertyNames.push_back("Meter label properties");
2572  propertyNames.push_back("Meter grid properties");
2573 }
2574 
2576  const char* prefix)const
2577 {
2578  kwl.add(prefix,
2579  VIEW_WIDTH_KW,
2581  true);
2582 
2583  kwl.add(prefix,
2584  VIEW_HEIGHT_KW,
2586  true);
2587 
2588  kwl.add(prefix,
2589  METER_GRID_SPACING_X_KW,
2591  true);
2592 
2593  kwl.add(prefix,
2594  METER_GRID_SPACING_Y_KW,
2596  true);
2597 
2598  kwl.add(prefix,
2599  GEO_GRID_SPACING_LON_KW,
2601  true);
2602 
2603  kwl.add(prefix,
2604  GEO_GRID_SPACING_LAT_KW,
2606  true);
2607 
2608  ossimString meterGridType = "line";
2610  {
2611  meterGridType = "none";
2612  }
2614  {
2615  meterGridType = "reseaux";
2616  }
2617 
2618  kwl.add(prefix,
2619  METER_GRID_TYPE_KW,
2620  meterGridType.c_str(),
2621  true);
2622 
2623  ossimString geoGridType = "line";
2625  {
2626  geoGridType = "none";
2627  }
2629  {
2630  geoGridType = "reseaux";
2631  }
2632 
2633  kwl.add(prefix,
2634  GEO_GRID_TYPE_KW,
2635  geoGridType.c_str(),
2636  true);
2637 
2638  kwl.add(prefix,
2639  TOP_BORDER_LENGTH_KW,
2641  true);
2642 
2643  kwl.add(prefix,
2644  BOTTOM_BORDER_LENGTH_KW,
2646  true);
2647 
2648  kwl.add(prefix,
2649  LEFT_BORDER_LENGTH_KW,
2651  true);
2652 
2653  kwl.add(prefix,
2654  RIGHT_BORDER_LENGTH_KW,
2656  true);
2657 
2658  kwl.add(prefix,
2659  BORDER_COLOR_KW,
2663  true);
2664 
2665  kwl.add(prefix,
2666  GEO_GRID_COLOR_KW,
2670  true);
2671 
2672  kwl.add(prefix,
2673  METER_GRID_COLOR_KW,
2677  true);
2678 
2679  kwl.add(prefix,
2680  TITLE_STRING_KW,
2682  true);
2683 
2684  kwl.add(prefix,
2685  TITLE_COLOR_KW,
2689  true);
2690 
2691  kwl.add(prefix,
2692  TOP_GEO_LABEL_COLOR_KW,
2696  true);
2697 
2698  kwl.add(prefix,
2699  BOTTOM_GEO_LABEL_COLOR_KW,
2703  true);
2704  kwl.add(prefix,
2705  LEFT_GEO_LABEL_COLOR_KW,
2709  true);
2710  kwl.add(prefix,
2711  RIGHT_GEO_LABEL_COLOR_KW,
2715  true);
2716 
2717  kwl.add(prefix,
2718  TOP_GEO_LABEL_FORMAT_KW,
2720  true);
2721 
2722  kwl.add(prefix,
2723  BOTTOM_GEO_LABEL_FORMAT_KW,
2725  true);
2726  kwl.add(prefix,
2727  LEFT_GEO_LABEL_FORMAT_KW,
2729  true);
2730  kwl.add(prefix,
2731  RIGHT_GEO_LABEL_FORMAT_KW,
2733  true);
2734 
2735  kwl.add(prefix,
2736  TOP_GEO_LABEL_FLAG_KW,
2738  true);
2739 
2740  kwl.add(prefix,
2741  BOTTOM_GEO_LABEL_FLAG_KW,
2743  true);
2744 
2745  kwl.add(prefix,
2746  LEFT_GEO_LABEL_FLAG_KW,
2748  true);
2749 
2750  kwl.add(prefix,
2751  RIGHT_GEO_LABEL_FLAG_KW,
2753  true);
2754 
2755  kwl.add(prefix,
2756  TOP_METER_LABEL_COLOR_KW,
2760  true);
2761 
2762  kwl.add(prefix,
2763  BOTTOM_METER_LABEL_COLOR_KW,
2767  true);
2768  kwl.add(prefix,
2769  LEFT_METER_LABEL_COLOR_KW,
2773  true);
2774  kwl.add(prefix,
2775  RIGHT_METER_LABEL_COLOR_KW,
2779  true);
2780 
2781 
2782  kwl.add(prefix,
2783  TOP_METER_LABEL_FLAG_KW,
2784  (int)theTopMeterLabelFlag,
2785  true);
2786 
2787  kwl.add(prefix,
2788  BOTTOM_METER_LABEL_FLAG_KW,
2790  true);
2791 
2792  kwl.add(prefix,
2793  LEFT_METER_LABEL_FLAG_KW,
2794  (int)theLeftMeterLabelFlag,
2795  true);
2796 
2797  kwl.add(prefix,
2798  RIGHT_METER_LABEL_FLAG_KW,
2800  true);
2801 
2802  theGeographicTopLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(TOP_GEO_LABEL_FONT_KW) + ".").c_str());
2803  theGeographicBottomLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(BOTTOM_GEO_LABEL_FONT_KW) + ".").c_str());
2804  theGeographicLeftLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(LEFT_GEO_LABEL_FONT_KW) + ".").c_str());
2805  theGeographicRightLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(RIGHT_GEO_LABEL_FONT_KW) + ".").c_str());
2806 
2807  theMeterTopLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(TOP_METER_LABEL_FONT_KW) + ".").c_str());
2808  theMeterBottomLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(BOTTOM_METER_LABEL_FONT_KW) + ".").c_str());
2809  theMeterLeftLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(LEFT_METER_LABEL_FONT_KW) + ".").c_str());
2810  theMeterRightLabelFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(RIGHT_METER_LABEL_FONT_KW) + ".").c_str());
2811 
2812  theTitleFontInfo.saveState(kwl, (ossimString(prefix) + ossimString(TITLE_FONT_KW) + ".").c_str());
2813 
2814 
2815  return ossimImageSource::saveState(kwl, prefix);
2816 
2817 }
2818 
2820  const char* prefix)
2821 {
2822  const char* viewWidth = kwl.find(prefix, VIEW_WIDTH_KW);
2823  const char* viewHeight = kwl.find(prefix, VIEW_HEIGHT_KW);
2824  const char* meterGridSpacingX = kwl.find(prefix, METER_GRID_SPACING_X_KW);
2825  const char* meterGridSpacingY = kwl.find(prefix, METER_GRID_SPACING_Y_KW);
2826  const char* geoGridSpacingLon = kwl.find(prefix, GEO_GRID_SPACING_LON_KW);
2827  const char* geoGridSpacingLat = kwl.find(prefix, GEO_GRID_SPACING_LAT_KW);
2828  const char* meterGridType = kwl.find(prefix, METER_GRID_TYPE_KW);
2829  const char* geoGridType = kwl.find(prefix, GEO_GRID_TYPE_KW);
2830  const char* topBorderLength = kwl.find(prefix, TOP_BORDER_LENGTH_KW);
2831  const char* bottomBorderLength = kwl.find(prefix, BOTTOM_BORDER_LENGTH_KW);
2832  const char* leftBorderLength = kwl.find(prefix, LEFT_BORDER_LENGTH_KW);
2833  const char* rightBorderLength = kwl.find(prefix, RIGHT_BORDER_LENGTH_KW);
2834 
2835  const char* borderColor = kwl.find(prefix, BORDER_COLOR_KW);
2836  const char* geoGridColor = kwl.find(prefix, GEO_GRID_COLOR_KW);
2837  const char* meterGridColor = kwl.find(prefix, METER_GRID_COLOR_KW);
2838  const char* titleString = kwl.find(prefix, TITLE_STRING_KW);
2839  const char* titleColor = kwl.find(prefix, TITLE_COLOR_KW);
2840 
2841  const char* topGeoLabelColor = kwl.find(prefix, TOP_GEO_LABEL_COLOR_KW);
2842  const char* bottomGeoLabelColor = kwl.find(prefix, BOTTOM_GEO_LABEL_COLOR_KW);
2843  const char* leftGeoLabelColor = kwl.find(prefix, LEFT_GEO_LABEL_COLOR_KW);
2844  const char* rightGeoLabelColor = kwl.find(prefix, RIGHT_GEO_LABEL_COLOR_KW);
2845 
2846  const char* topMeterLabelColor = kwl.find(prefix, TOP_METER_LABEL_COLOR_KW);
2847  const char* bottomMeterLabelColor = kwl.find(prefix, BOTTOM_METER_LABEL_COLOR_KW);
2848  const char* leftMeterLabelColor = kwl.find(prefix, LEFT_METER_LABEL_COLOR_KW);
2849  const char* rightMeterLabelColor = kwl.find(prefix, RIGHT_METER_LABEL_COLOR_KW);
2850 
2851  const char* topGeoLabelFormat = kwl.find(prefix, TOP_GEO_LABEL_FORMAT_KW);
2852  const char* bottomGeoLabelFormat = kwl.find(prefix, BOTTOM_GEO_LABEL_FORMAT_KW);
2853  const char* leftGeoLabelFormat = kwl.find(prefix, LEFT_GEO_LABEL_FORMAT_KW);
2854  const char* rightGeoLabelFormat = kwl.find(prefix, RIGHT_GEO_LABEL_FORMAT_KW);
2855 
2856  const char* topGeoLabelFlag = kwl.find(prefix, TOP_GEO_LABEL_FLAG_KW);
2857  const char* bottomGeoLabelFlag = kwl.find(prefix, BOTTOM_GEO_LABEL_FLAG_KW);
2858  const char* leftGeoLabelFlag = kwl.find(prefix, LEFT_GEO_LABEL_FLAG_KW);
2859  const char* rightGeoLabelFlag = kwl.find(prefix, RIGHT_GEO_LABEL_FLAG_KW);
2860 
2861  const char* topMeterLabelFlag = kwl.find(prefix, TOP_METER_LABEL_FLAG_KW);
2862  const char* bottomMeterLabelFlag = kwl.find(prefix, BOTTOM_METER_LABEL_FLAG_KW);
2863  const char* leftMeterLabelFlag = kwl.find(prefix, LEFT_METER_LABEL_FLAG_KW);
2864  const char* rightMeterLabelFlag = kwl.find(prefix, RIGHT_METER_LABEL_FLAG_KW);
2865 
2868 
2869  if(viewWidth)
2870  {
2871  theViewWidthHeight.x = ossimString(viewWidth).toLong();
2872  }
2873  if(viewHeight)
2874  {
2875  theViewWidthHeight.y = ossimString(viewHeight).toLong();
2876  }
2877 
2878  if(meterGridSpacingX)
2879  {
2880  theMeterSpacing.x = ossimString(meterGridSpacingX).toDouble();
2881  }
2882 
2883  if(meterGridSpacingY)
2884  {
2885  theMeterSpacing.y = ossimString(meterGridSpacingY).toDouble();
2886  }
2887  if(geoGridSpacingLon)
2888  {
2889  theGeographicSpacing.lon = ossimString(geoGridSpacingLon).toDouble();
2890  }
2891  if(geoGridSpacingLat)
2892  {
2893  theGeographicSpacing.lat = ossimString(geoGridSpacingLat).toDouble();
2894  }
2895  if(meterGridType)
2896  {
2897  ossimString type = ossimString(meterGridType).trim().downcase();
2898  if(type == "reseaux")
2899  {
2901  }
2902  else if(type == "line")
2903  {
2905  }
2906  else
2907  {
2909  }
2910  }
2911 
2912  if(geoGridType)
2913  {
2914  ossimString type = ossimString(geoGridType).trim().downcase();
2915  if(type == "reseaux")
2916  {
2918  }
2919  else if(type == "line")
2920  {
2922  }
2923  else
2924  {
2926  }
2927  }
2928 
2929  if(topBorderLength)
2930  {
2931  theTopBorderLength = ossimString(topBorderLength).toULong();
2932  }
2933 
2934  if(bottomBorderLength)
2935  {
2936  theBottomBorderLength = ossimString(bottomBorderLength).toULong();
2937  }
2938  if(leftBorderLength)
2939  {
2940  theLeftBorderLength = ossimString(leftBorderLength).toULong();
2941  }
2942  if(rightBorderLength)
2943  {
2944  theRightBorderLength = ossimString(rightBorderLength).toULong();
2945  }
2946 
2947  if(borderColor)
2948  {
2949  istringstream in(borderColor);
2950 
2951  ossimString r;
2952  ossimString g;
2953  ossimString b;
2954  in >> r >> g >> b;
2955 
2957  (ossim_uint8)g.toUInt32(),
2958  (ossim_uint8)b.toUInt32());
2959  }
2960 
2961  if(geoGridColor)
2962  {
2963  istringstream in(geoGridColor);
2964 
2965  ossimString r;
2966  ossimString g;
2967  ossimString b;
2968  in >> r >> g >> b;
2969 
2971  }
2972 
2973  if(meterGridColor)
2974  {
2975  istringstream in(meterGridColor);
2976 
2977  ossimString r;
2978  ossimString g;
2979  ossimString b;
2980  in >> r >> g >> b;
2981 
2983  }
2984 
2985  if(titleString)
2986  {
2987  theTitleString = titleString;
2988  }
2989 
2990  if(titleColor)
2991  {
2992  istringstream in(titleColor);
2993 
2994  ossimString r;
2995  ossimString g;
2996  ossimString b;
2997  in >> r >> g >> b;
2998 
2999 
3001  }
3002 
3003  if(topGeoLabelColor)
3004  {
3005  istringstream in(topGeoLabelColor);
3006 
3007  ossimString r;
3008  ossimString g;
3009  ossimString b;
3010  in >> r >> g >> b;
3011 
3013  }
3014 
3015  if(bottomGeoLabelColor)
3016  {
3017  istringstream in(bottomGeoLabelColor);
3018 
3019  ossimString r;
3020  ossimString g;
3021  ossimString b;
3022  in >> r >> g >> b;
3023 
3025  }
3026 
3027  if(leftGeoLabelColor)
3028  {
3029  istringstream in(leftGeoLabelColor);
3030 
3031  ossimString r;
3032  ossimString g;
3033  ossimString b;
3034  in >> r >> g >> b;
3035 
3037  }
3038 
3039  if(rightGeoLabelColor)
3040  {
3041  istringstream in(rightGeoLabelColor);
3042 
3043  ossimString r;
3044  ossimString g;
3045  ossimString b;
3046  in >> r >> g >> b;
3047 
3049  }
3050 
3051 
3053  if(topMeterLabelColor)
3054  {
3055  istringstream in(topMeterLabelColor);
3056 
3057  ossimString r;
3058  ossimString g;
3059  ossimString b;
3060  in >> r >> g >> b;
3061 
3063  }
3064 
3065  if(bottomMeterLabelColor)
3066  {
3067  istringstream in(bottomMeterLabelColor);
3068 
3069  ossimString r;
3070  ossimString g;
3071  ossimString b;
3072  in >> r >> g >> b;
3073 
3075  }
3076 
3077  if(leftMeterLabelColor)
3078  {
3079  istringstream in(leftMeterLabelColor);
3080 
3081  ossimString r;
3082  ossimString g;
3083  ossimString b;
3084  in >> r >> g >> b;
3085 
3087  }
3088 
3089  if(rightMeterLabelColor)
3090  {
3091  istringstream in(rightMeterLabelColor);
3092 
3093  ossimString r;
3094  ossimString g;
3095  ossimString b;
3096  in >> r >> g >> b;
3097 
3099  }
3100 
3101  if(topGeoLabelFormat)
3102  {
3103  theTopGeographicFormat = topGeoLabelFormat;
3104  }
3105 
3106  if(bottomGeoLabelFormat)
3107  {
3108  theBottomGeographicFormat = bottomGeoLabelFormat;
3109  }
3110 
3111  if(leftGeoLabelFormat)
3112  {
3113  theLeftGeographicFormat = leftGeoLabelFormat;
3114  }
3115 
3116  if(rightGeoLabelFormat)
3117  {
3118  theRightGeographicFormat = rightGeoLabelFormat;
3119  }
3120 
3121  if(topGeoLabelFlag)
3122  {
3123  theTopGeographicLabelFlag = ossimString(topGeoLabelFlag).toBool();
3124  }
3125  if(bottomGeoLabelFlag)
3126  {
3127  theBottomGeographicLabelFlag = ossimString(bottomGeoLabelFlag).toBool();
3128  }
3129  if(leftGeoLabelFlag)
3130  {
3131  theLeftGeographicLabelFlag = ossimString(leftGeoLabelFlag).toBool();
3132  }
3133  if(rightGeoLabelFlag)
3134  {
3135  theRightGeographicLabelFlag = ossimString(rightGeoLabelFlag).toBool();
3136  }
3137 
3138  if(topMeterLabelFlag)
3139  {
3140  theTopMeterLabelFlag = ossimString(topMeterLabelFlag).toBool();
3141  }
3142  if(bottomMeterLabelFlag)
3143  {
3144  theBottomMeterLabelFlag = ossimString(bottomMeterLabelFlag).toBool();
3145  }
3146  if(leftMeterLabelFlag)
3147  {
3148  theLeftMeterLabelFlag = ossimString(leftMeterLabelFlag).toBool();
3149  }
3150  if(rightMeterLabelFlag)
3151  {
3152  theRightMeterLabelFlag = ossimString(rightMeterLabelFlag).toBool();
3153  }
3154 
3155  theGeographicTopLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(TOP_GEO_LABEL_FONT_KW) + ".").c_str());
3156  theGeographicBottomLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(BOTTOM_GEO_LABEL_FONT_KW) + ".").c_str());
3157  theGeographicLeftLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(LEFT_GEO_LABEL_FONT_KW) + ".").c_str());
3158  theGeographicRightLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(RIGHT_GEO_LABEL_FONT_KW) + ".").c_str());
3159 
3160  theMeterTopLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(TOP_METER_LABEL_FONT_KW) + ".").c_str());
3161  theMeterBottomLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(BOTTOM_METER_LABEL_FONT_KW) + ".").c_str());
3162  theMeterLeftLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(LEFT_METER_LABEL_FONT_KW) + ".").c_str());
3163  theMeterRightLabelFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(RIGHT_METER_LABEL_FONT_KW) + ".").c_str());
3164 
3165  theTitleFontInfo.loadState(kwl, (ossimString(prefix) + ossimString(TITLE_FONT_KW) + ".").c_str());
3171 
3176 
3177  vector<ossimFontInformation> info;
3178 
3179 
3180  if(!theTitleFont)
3181  {
3184  theTitleFontInfo = info[0];
3185  }
3187  {
3188  info.clear();
3192  }
3194  {
3195  info.clear();
3199  }
3201  {
3202  info.clear();
3206  }
3208  {
3209  info.clear();
3213  }
3214 
3216  {
3217  info.clear();
3220  theMeterTopLabelFontInfo = info[0];
3221  }
3223  {
3224  info.clear();
3227  theMeterBottomLabelFontInfo = info[0];
3228  }
3230  {
3231  info.clear();
3234  theMeterLeftLabelFontInfo = info[0];
3235  }
3237  {
3238  info.clear();
3241  theMeterRightLabelFontInfo = info[0];
3242  }
3243 
3244  bool result = ossimAnnotationSource::loadState(kwl,
3245  prefix);
3247 
3248  return result;
3249 }
3250 
3252 {
3253  return OSSIM_UCHAR;
3254 }
3255 
3257 {
3258  return 3;
3259 }
3260 
3262 {
3263  return theViewWidthHeight;
3264 }
3265 
3267 {
3268  widthHeight = theViewWidthHeight;
3269 }
3270 
3272 {
3273  theViewWidthHeight = widthHeight;
3274 }
3275 
3277 {
3278  return theTopBorderLength;
3279 }
3280 
3282 {
3283  return theBottomBorderLength;
3284 }
3285 
3287 {
3288  return theLeftBorderLength;
3289 }
3290 
3292 {
3293  return theRightBorderLength;
3294 }
3295 
3297 {
3298  theTopBorderLength = length;
3299 }
3300 
3302 {
3303  theBottomBorderLength = length;
3304 }
3305 
3307 {
3308  theLeftBorderLength = length;
3309 }
3310 
3312 {
3313  theRightBorderLength = length;
3314 }
3315 
3317 {
3318  theGeographicSpacing.lat = value;
3319 }
3320 
3322 {
3323  theGeographicSpacing.lon = value;
3324 }
3325 
3327 {
3328  theMeterSpacing.x = value;
3329 }
3330 
3332 {
3333  theMeterSpacing.y = value;
3334 }
3335 
3337 {
3338  theMeterSpacing.x = x;
3339  theMeterSpacing.y = y;
3340 }
3341 
3343 {
3344  theGeographicSpacing.lat = lat;
3345  theGeographicSpacing.lon = lon;
3346 }
3347 
3349 {
3350  return theGeographicSpacing;
3351 }
3352 
3354 {
3355  return theMeterSpacing;
3356 }
3357 
3359 {
3360  return theTopGeographicFormat;
3361 }
3362 
3364 {
3366 }
3367 
3369 {
3370  return theLeftGeographicFormat;
3371 }
3372 
3374 {
3375  return theRightGeographicFormat;
3376 }
3377 
3379 {
3380  return theTitleString;
3381 }
3382 
3384 {
3385  return theTitleColor;
3386 }
3387 
3389 {
3390  if(theTitleColor != color)
3391  {
3392  theTitleColor = color;
3393  }
3394 }
3395 
3397 {
3398  if(theTitleString != s)
3399  {
3400  theTitleString = s;
3401  }
3402 
3403 }
3404 
3406 {
3407  return theTitleFontInfo;
3408 }
3409 
3411 {
3413 }
3414 
3416 {
3418 }
3419 
3421 {
3423 }
3424 
3426 {
3428 }
3429 
3431 {
3432  return theMeterTopLabelFontInfo;
3433 }
3434 
3436 {
3438 }
3439 
3441 {
3443 }
3444 
3446 {
3448 }
3449 
3451 {
3452  return theBorderColor;
3453 }
3454 
3456 {
3457  theBorderColor=color;
3458 }
3459 
3461 {
3462  return theGeographicGridColor;
3463 }
3464 
3466 {
3467  return theMeterGridColor;
3468 }
3469 
3471 {
3473 }
3474 
3476 {
3478 }
3479 
3481 {
3483 }
3484 
3486 {
3488 }
3489 
3491 {
3492  theGeographicGridColor = color;
3493 }
3494 
3496 {
3498 }
3499 
3501 {
3503 }
3504 
3506 {
3508 }
3509 
3511 {
3513 }
3514 
3516 {
3521 }
3522 
3524 {
3525  return theTopMeterLabelColor;
3526 }
3527 
3529 {
3530  return theBottomMeterLabelColor;
3531 }
3532 
3534 {
3535  return theLeftMeterLabelColor;
3536 }
3537 
3539 {
3540  return theRightMeterLabelColor;
3541 }
3542 
3544 {
3545  theTopMeterLabelColor = color;
3546 }
3547 
3549 {
3550  theBottomMeterLabelColor = color;
3551 }
3552 
3554 {
3555  theLeftMeterLabelColor = color;
3556 }
3557 
3559 {
3560  theRightMeterLabelColor = color;
3561 }
3562 
3564 {
3565  setTopMeterLabelColor(color);
3566  setBottomMeterLabelColor(color);
3567  setLeftMeterLabelColor(color);
3568  setRightMeterLabelColor(color);
3569 }
3570 
3572 {
3573  theMeterGridColor = color;
3574 }
3575 
3577 {
3578  theMeterGridType = gridType;
3579 }
3580 
3582 {
3583  theGeographicGridType = gridType;
3584 }
3585 
3587 {
3588  theBorderColor = color;
3589 }
3590 
3592 {
3593  return theGeographicGridType;
3594 }
3595 
3597 {
3598  return theMeterGridType;
3599 }
3600 
3602 {
3607 }
3608 
3610 {
3611  theTopGeographicTickFlag = flag;
3612 }
3613 
3615 {
3617 }
3618 
3620 {
3622 }
3623 
3625 {
3627 }
3628 
3630 {
3632 }
3633 
3635 {
3637 }
3638 
3640 {
3642 }
3643 
3645 {
3647 }
3648 
3650 {
3651  return theTopGeographicTickFlag;
3652 }
3653 
3655 {
3657 }
3658 
3660 {
3662 }
3663 
3665 {
3667 }
3668 
3670 {
3672 }
3673 
3675 {
3677 }
3678 
3680 {
3682 }
3683 
3685 {
3687 }
3688 
3690 {
3695 }
3696 
3698 {
3699  theTopMeterTickFlag = flag;
3700 }
3701 
3703 {
3704  theBottomMeterTickFlag = flag;
3705 }
3706 
3708 {
3709  theLeftMeterTickFlag = flag;
3710 }
3711 
3713 {
3714  theRightMeterTickFlag = flag;
3715 }
3716 
3718 {
3719  theTopMeterLabelFlag = flag;
3720 }
3721 
3723 {
3724  theBottomMeterLabelFlag = flag;
3725 }
3726 
3728 {
3729  theLeftMeterLabelFlag = flag;
3730 }
3731 
3733 {
3734  theRightMeterLabelFlag = flag;
3735 }
3736 
3738 {
3739  return theTopMeterTickFlag;
3740 }
3741 
3743 {
3744  return theBottomMeterTickFlag;
3745 }
3746 
3748 {
3749  return theLeftMeterTickFlag;
3750 }
3751 
3753 {
3754  return theRightMeterTickFlag;
3755 }
3756 
3758 {
3759  return theTopMeterLabelFlag;
3760 }
3761 
3763 {
3764  return theBottomMeterLabelFlag;
3765 }
3766 
3768 {
3769  return theLeftMeterLabelFlag;
3770 }
3771 
3773 {
3774  return theRightMeterLabelFlag;
3775 }
3776 
3778 {
3779  if(obj)
3780  {
3781  theFixedAnnotationList.push_back(obj);
3782  }
3783 }
3784 
3785 //**************************************************************************************************
3788 //**************************************************************************************************
3790 {
3791  if (!theInputConnection)
3792  return 0;
3793 
3795  if (!inputGeom)
3796  return 0;
3797 
3798  return PTR_CAST(ossimMapProjection, inputGeom->getProjection());
3799 }
3800 
virtual void loadBand(const void *src, const ossimIrect &src_rect, ossim_uint32 band)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual void setTopMeterTickMarkFlag(bool flag)
virtual void valueToString(ossimString &valueResult) const =0
ossim_uint32 x
virtual void setMeterRightLabelFont(const ossimFontInformation &fontInfo)
ossimAnnotationSource::AnnotationObjectListType theFixedAnnotationList
virtual void setMeterLabelColor(const ossimRgbVector &color)
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
virtual ossim_int32 getLeftBorderLength() const
virtual ossimRgbVector getRightGeographicLabelColor() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
bool pointWithin(const ossimDpt &pt, double epsilon=0.0) const
Definition: ossimDrect.h:781
void makeNan()
Definition: ossimIpt.h:56
virtual void setMeterTopLabelFont(const ossimFontInformation &fontInfo)
virtual ossim_uint32 getNumberOfBands() const
unsigned char getR() const
virtual void setGeographicBottomLabelFont(const ossimFontInformation &fontInfo)
#define CLOG
Definition: ossimTrace.h:23
virtual void setRightBorderLength(ossim_int32 length)
virtual void setImageRectangle(const ossimIrect &rect)
ossim_float64 width() const
Definition: ossimDrect.h:522
virtual ossimFontInformation getGeographicLeftLabelFontInfo() const
virtual ossimFontInformation getMeterTopLabelFontInfo() const
ossimFontInformation theMeterBottomLabelFontInfo
ossimRefPtr< ossimFont > theMeterLeftLabelFont
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
Represents serializable keyword/value map.
virtual void setGeographicGridType(ossimGridLineType gridType)
ossim_uint32 y
virtual bool getBottomGeographicTickMarkFlag() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual bool getLeftMeterTickMarkFlag() const
bool valid() const
Definition: ossimRefPtr.h:75
virtual void setFont(ossimFont *font)
virtual ossimString getRightGeographicLabelFormat() const
virtual void setBottomMeterTickMarkFlag(bool flag)
const char * find(const char *key) const
virtual ossimFontInformation getGeographicRightLabelFontInfo() const
ossimFontInformation theGeographicTopLabelFontInfo
virtual void addFixedAnnotation(ossimAnnotationObject *obj)
virtual ossimDpt worldToLineSample(const ossimGpt &worldPoint) const
const ossimDpt & ul() const
Definition: ossimDrect.h:339
virtual void getFontInformation(vector< ossimFontInformation > &fontInformationList) const
Definition: ossimFont.h:281
double y
Definition: ossimDpt.h:165
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossimGridLineType getGeographicGridType() const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void setRightGeographicLabelColor(const ossimRgbVector &color)
virtual void setMeterGridType(ossimGridLineType gridType)
ossimRefPtr< ossimFont > theMeterTopLabelFont
virtual void setRightMeterLabelColor(const ossimRgbVector &color)
virtual void setGeographicLabelFormat(const ossimString format)
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossimRgbVector getGeographicGridColor() const
ossim_uint32 toUInt32() const
virtual ossimFontInformation getMeterRightLabelFontInfo() const
virtual ossimRgbVector getTopGeographicLabelColor() const
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
virtual bool getLeftGeographicLabelFlag() const
virtual bool getBottomMeterTickMarkFlag() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name, bool recurse=false)
const ossimIpt & ll() const
Definition: ossimIrect.h:277
virtual ossimFontInformation getGeographicBottomLabelFontInfo() const
virtual void setBottomGeographicLabelColor(const ossimRgbVector &color)
virtual ossimRgbVector getBorderColor() const
virtual void setLeftGeographicLabelFormat(const ossimString &format)
virtual ossimString getLeftGeographicLabelFormat() const
virtual void setTopMeterLabelColor(const ossimRgbVector &color)
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
virtual void setMeterLeftLabelFont(const ossimFontInformation &fontInfo)
virtual void setLeftMeterTickMarkFlag(bool flag)
ossimFontInformation theMeterRightLabelFontInfo
ossimRefPtr< ossimFont > theGeographicTopLabelFont
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
void setViewWidthHeight(const ossimIpt &widthHeight)
virtual ossimRgbVector getBottomMeterLabelColor() const
virtual ossimRgbVector getMeterGridColor() const
ossimFontInformation theGeographicLeftLabelFontInfo
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool getTopGeographicTickMarkFlag() const
virtual ossim_int32 getTopBorderLength() const
virtual ossimRgbVector getRightMeterLabelColor() const
virtual bool getRightMeterTickMarkFlag() const
void getFontInformation(std::vector< ossimFontInformation > &informationList) const
ossimDrect clipToRect(const ossimDrect &rect) const
Definition: ossimDrect.cpp:769
virtual ossimGpt lineSampleToWorld(const ossimDpt &projectedPoint) const
double lat
Definition: ossimDpt.h:165
ossimFontInformation theMeterLeftLabelFontInfo
virtual void setTopGeographicLabelColor(const ossimRgbVector &color)
ossimRefPtr< ossimFont > theGeographicBottomLabelFont
ossimFontInformation theMeterTopLabelFontInfo
virtual void setBottomMeterLabelColor(const ossimRgbVector &color)
virtual bool getBottomMeterLabelFlag() const
ossimRefPtr< ossimImageData > getImageData()
Will return the image data.
virtual void setGeographicLeftLabelFont(const ossimFontInformation &fontInfo)
virtual ossimDataObjectStatus validate() const
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual void lineSampleToEastingNorthing(const ossimDpt &liineSample, ossimDpt &eastingNorthing) const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual void setTitle(const ossimString &s)
ossimFontInformation theGeographicRightLabelFontInfo
ossimIpt midPoint() const
Definition: ossimIrect.h:750
virtual void drawAnnotations(ossimRefPtr< ossimImageData > tile)
virtual void setRightGeographicLabelFormat(const ossimString &format)
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
bool toBool() const
String to numeric methods.
virtual bool getTopGeographicLabelFlag() const
RTTI_DEF1(ossimMapCompositionSource, "ossimMapCompositionSource", ossimAnnotationSource)
ossimImageSource * theInputConnection
virtual void getBoundingBox(ossimIrect &box)=0
ossimRefPtr< ossimFont > theGeographicLeftLabelFont
unsigned int ossim_uint32
virtual ossimFontInformation getMeterLeftLabelFontInfo() const
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
double toDouble() const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
const ossimRgbVector & getColor() const
unsigned long toULong() const
virtual ossimIrect getImageRectangle() const
virtual void setGeographicRightLabelFont(const ossimFontInformation &fontInfo)
unsigned char getB() const
virtual void setGeographicTopLabelFont(const ossimFontInformation &fontInfo)
virtual ossim_int32 getRightBorderLength() const
ossimRefPtr< ossimFont > theTitleFont
virtual ossimRgbVector getTopMeterLabelColor() const
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossimFont * createFont(const ossimFontInformation &information) const
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
Class to draw fonts onto an image.
virtual void setLeftMeterLabelColor(const ossimRgbVector &color)
virtual void setTitleColor(const ossimRgbVector &color)
virtual ossimGridLineType getMeterGridType() const
bool hasNans() const
Definition: ossimDrect.h:396
virtual void setGeometryInformation(const ossimFontInformation &info)
#define DBL_EPSILON
ossim_uint32 width() const
Definition: ossimIrect.h:500
const ossimFontInformation & getFontInformation() const
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
bool hasNans() const
Definition: ossimDpt.h:67
bool intersects(const ossimDrect &rect) const
Definition: ossimDrect.cpp:289
double lon
Definition: ossimDpt.h:164
ossim_float64 height() const
Definition: ossimDrect.h:517
virtual ossimRgbVector getTitleColor() const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
virtual ossimObject * dup() const =0
const ossimIpt & ur() const
Definition: ossimIrect.h:275
virtual void setBottomGeographicLabelFormat(const ossimString &format)
virtual bool getRightGeographicLabelFlag() const
void setMeterSpacing(double x, double y)
virtual ossim_int32 getBottomBorderLength() const
ossimScalarType
virtual ossimRgbVector getLeftGeographicLabelColor() const
bool clip(ossimDpt &p1, ossimDpt &p2) const
Definition: ossimDrect.cpp:653
unsigned char getG() const
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossimRefPtr< ossimFont > theMeterBottomLabelFont
long toLong() const
toLong&#39;s deprecated, please use the toInts...
virtual void setString(const ossimString &s)
Definition: ossimFont.h:119
virtual void setRightMeterTickMarkFlag(bool flag)
virtual void setLeftMeterLabelFlag(bool flag)
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the current state of this object.
virtual void setBottomMeterLabelFlag(bool flag)
static ossimFontFactoryRegistry * instance()
virtual bool getTopMeterTickMarkFlag() const
virtual void setRightMeterLabelFlag(bool flag)
ossim_int32 y
Definition: ossimIpt.h:142
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual void setTopMeterLabelFlag(bool flag)
void makeNan()
Definition: ossimIrect.h:329
virtual const void * getBuf() const
virtual bool getBottomGeographicLabelFlag() const
virtual void setBottomBorderLength(ossim_int32 length)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual bool getRightGeographicTickMarkFlag() const
const ossimDpt & ur() const
Definition: ossimDrect.h:340
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
void setGeographicSpacing(double lat, double lon)
ossimRefPtr< ossimFont > theMeterRightLabelFont
ossimRefPtr< ossimRgbImage > theImage
virtual ossimString getBottomGeographicLabelFormat() const
virtual void setMeterGridColor(const ossimRgbVector &color)
virtual ossimRgbVector getLeftMeterLabelColor() const
double x
Definition: ossimDpt.h:164
virtual ossimFontInformation getGeographicTopLabelFontInfo() const
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
virtual void eastingNorthingToLineSample(const ossimDpt &eastingNorthing, ossimDpt &lineSample) const
virtual void setLeftBorderLength(ossim_int32 length)
virtual void setMeterBottomLabelFont(const ossimFontInformation &fontInfo)
bool hasNans() const
Definition: ossimIrect.h:337
ossimFontInformation theGeographicBottomLabelFontInfo
void allocate(const ossimIrect &rect)
const ossimMapProjection * inputMapProjection() const
Fetches the input connection&#39;s image geometry and verifies that it is a map projection.
virtual void setGeographicGridColor(const ossimRgbVector &color)
ossim_int32 x
Definition: ossimIpt.h:141
const ossimDpt & ll() const
Definition: ossimDrect.h:342
virtual void setBorderColor(const ossimRgbVector &color)
virtual ossimRgbVector getBottomGeographicLabelColor() const
virtual void setGeographicLabelColor(const ossimRgbVector &color)
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
virtual void setLeftGeographicLabelColor(const ossimRgbVector &color)
virtual ossimFontInformation getTitleFont() const
virtual void addChild(ossimProperty *propery)
void setCurrentImageData(ossimRefPtr< ossimImageData > &imageData)
Allows you to change the image data that this RgbImage object operates on.
ossimRefPtr< ossimFont > theGeographicRightLabelFont
virtual void drawAnnotations(ossimRefPtr< ossimImageData > tile)
ossimRefPtr< ossimImageData > theTile
virtual void setTopBorderLength(ossim_int32 length)
virtual void setTitleFont(const ossimFontInformation &fontInfo)
const ossimDpt & lr() const
Definition: ossimDrect.h:341
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossimString getTopGeographicLabelFormat() const
virtual void getBoundingRect(ossimDrect &rect) const
unsigned char ossim_uint8
virtual void setTopGeographicLabelFormat(const ossimString &format)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setCacheRefreshBit()
8 bit unsigned iteger
virtual void setCenterPosition(const ossimIpt &position)
const ossimString & getName() const
#define min(a, b)
Definition: auxiliary.h:75
virtual ossimString getTitle() const
int ossim_int32
ossimString toString(const ossimString &formatString=ossimString("")) const
You can specify a number of different formats.
Definition: ossimDms.cpp:294
virtual ossimFontInformation getMeterBottomLabelFontInfo() const
virtual bool getLeftGeographicTickMarkFlag() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)