VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shapeProjectionInformation.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2005 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: shapeProjectionInformation.h,v $ $Revision: 1.12 $ $State: Exp $
7 *******************************************************************************/
8 #ifndef shapeProjectionInformation_H_
9 #define shapeProjectionInformation_H_
10 
11 #include "shape/shapeDefines.h"
12 #include <vlutil/vlString.h>
13 #include <vlutil/vlConfig.h>
14 #include <list>
15 #include <map>
16 
18 class DtPoint;
19 class Coordinate_System;
20 class DtShapeInitializer;
22 class DtFilename;
23 
24 typedef std::list<DtShapeProjectionInformation*> DtShapeProjectionInformationList;
25 
27 {
28 public:
31 
33 
34  virtual bool load(FILE*);
35  virtual bool valueFor(const DtString& key, DtString& value) const;
36  virtual void parseBracketString(const DtString& bracketString);
37 
38  DtString key() const;
39  DtString value() const;
40  void setValue(const DtString&);
41  const DtShapeProjectionInformationList& children() const;
42 
43  virtual void add(const DtString& key, const DtString& val);
44 
45  virtual void addKeyword(const DtString& kw, const DtString& expectedValues);
46  void initializeKeywords();
47 
48 protected:
49  virtual DtString readKeyword(FILE* f);
50  virtual bool parseContents(FILE* f, const DtString& expected);
51  virtual DtString parseString(FILE* f);
52  virtual DtString allBetweenBrackets(FILE* f);
53  virtual void addChildren(FILE* f);
54  virtual void parseKeyValuePair();
55 
56 protected:
58 
60 
62 
64 
65  std::map<DtString, DtString> myKeywords;
66 };
67 
69 {
70 public:
72  virtual ~DtShapeProjection();
73 
74  virtual bool load(FILE*, const DtShapeInitializer*);
75  virtual bool load(FILE*, const DtShapeVectorInitializer*);
76  virtual bool valueFor(const DtString& key, DtString& value) const;
77 
78  static DtShapeProjection* create();
79 
80  // Returns true if the projection is a transverse mercator projection. It will then convert
81  // the TM value to geodetic. The projection will be considered a TM projection if it is
82  // projected and has both a central meridian and scale factor defined
83  virtual bool isTransverseMercator() const;
84  virtual bool isProjected() const;
85 
86  virtual void add(const DtString& key, const DtString& val);
87  Coordinate_System* coordinateSystem() { return myCoordinateSystem; };
88  virtual Coordinate_System* createCoordinateSystem() const;
89 
90  // Creates a new coordinate system based on contents of a given projection (.prj) file.
91  // Caller is responsible for deleting the memory associated with the coordinate system.
92  static Coordinate_System* createCoordinateSystem(const DtFilename& projectionFile);
93 
94 public:
95  // Given the projection, convert from source projection to geodetic (degrees, not radians). This
96  // supports mappings from keywords (string) to coordinate system types. Currently supported type
97  // is only UTM. Note the point p must be in the source mapping. If no mapping exists, the point
98  // is not modified
99  virtual bool convertPointFromProjectionToGeodetic(DtPoint& p) const;
100 
101  void setInitializer(const DtShapeInitializer*);
102  void setVectorInitializer(const DtShapeVectorInitializer*);
103 
104 protected:
106 
110 };
111 
112 typedef DtShapeProjection* (*DtShapeProjectionCreatorFcn)();
113 
115 {
116  myInitializer = i;
117 }
118 
120 {
122 }
123 
125 {
126  return myKey;
127 }
128 
130 {
131  return myValue;
132 }
133 
135 {
136  myValue = val;
137 }
138 
140 {
141  return myChildren;
142 }
143 
144 #endif

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)