cmap-cvs Mailing List for cmap (Page 9)
Status: Beta
Brought to you by:
dyp
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(87) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(5) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
(5) |
May
|
Jun
(6) |
Jul
|
Aug
(13) |
Sep
(5) |
Oct
(5) |
Nov
|
Dec
(5) |
2006 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(11) |
Nov
(4) |
Dec
(24) |
2007 |
Jan
(17) |
Feb
(9) |
Mar
(13) |
Apr
(3) |
May
(1) |
Jun
(7) |
Jul
(8) |
Aug
(17) |
Sep
(4) |
Oct
(2) |
Nov
(8) |
Dec
(7) |
2008 |
Jan
(2) |
Feb
(4) |
Mar
(32) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(15) |
Aug
(6) |
Sep
(5) |
Oct
(5) |
Nov
(2) |
Dec
|
From: Denis P. <dy...@us...> - 2004-11-07 14:01:40
|
Update of /cvsroot/cmap/libs/eval In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30034 Modified Files: parser.h parser.cpp Log Message: Add line number to ParserException (not used yet) Make parseBlockStart not abstract. Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/libs/eval/parser.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- parser.cpp 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ parser.cpp 7 Nov 2004 14:01:23 -0000 1.2 @@ -3,7 +3,7 @@ #include "object.h" #include "parser.h" -ParserException::ParserException(const char *_msg) : msg(_msg) { +ParserException::ParserException(const char *_msg, int _line) : msg(_msg), line(_line) { } ParserException::~ParserException() throw () { @@ -364,3 +364,6 @@ } } } + +void ConfigParser::parseBlockStart(ObjectConf *) { +} Index: parser.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/parser.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- parser.h 31 Oct 2004 09:06:40 -0000 1.2 +++ parser.h 7 Nov 2004 14:01:23 -0000 1.3 @@ -8,13 +8,15 @@ class ParserException : public std::exception { public: - ParserException(const char *_msg); + ParserException(const char *_msg, int lineno = 0); virtual ~ParserException() throw (); static void raise(const char *_msg); virtual const char *name() const throw(); virtual const char *what() const throw(); + int lineno() const { return line; } private: std::string msg; + int line; }; class ConfigParser { @@ -44,7 +46,7 @@ void parseAssign(Block *b, const std::string &varName); void parseBlock(Block *b, ObjectConf *obj = NULL); - virtual void parseBlockStart(ObjectConf *obj) = 0; + virtual void parseBlockStart(ObjectConf *obj); virtual bool parseObject() = 0; |
From: Denis P. <dy...@us...> - 2004-11-07 14:00:44
|
Update of /cvsroot/cmap/libs/eval In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29764 Modified Files: tokenizer.h tokenizer.cpp Log Message: Add parsing of float point numbers to tokenizer. Index: tokenizer.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/tokenizer.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- tokenizer.h 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ tokenizer.h 7 Nov 2004 14:00:34 -0000 1.2 @@ -32,8 +32,9 @@ const int TT_EOF = -1; const int TT_EOL = -2; const int TT_NUMBER = -3; -const int TT_WORD = -4; -const int TT_STRING = -5; +const int TT_FLOAT = -4; +const int TT_WORD = -5; +const int TT_STRING = -6; const short CT_WHITESPACE = 1; const short CT_DIGIT = 2; @@ -44,6 +45,7 @@ class Tokenizer { public: int nval; + double dval; std::string sval; int ttype; @@ -59,6 +61,9 @@ void ordinaryChar(char c); void ordinaryChars(int a, int b); void parseNumbers(); + void parseFloats() { + isParseFloats = true; + }; void pushBack(); void quoteChar(char c); void resetSyntax(); @@ -78,6 +83,7 @@ bool noCRLFInQuoteP; bool forceLower; bool pushedBack; + bool isParseFloats; short ctype[256]; int peekc; Index: tokenizer.cpp =================================================================== RCS file: /cvsroot/cmap/libs/eval/tokenizer.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- tokenizer.cpp 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ tokenizer.cpp 7 Nov 2004 14:00:34 -0000 1.2 @@ -44,18 +44,11 @@ } Tokenizer::Tokenizer(FILE *_f) : f(_f) { - eolIsSignificantP = false; - slashSlashCommentsP = false; - slashStarCommentsP = false; - noCRLFInQuoteP = false; + resetSyntax(); ttype = TT_NOTHING; - - for (int i = 0; i < 256; i++) - ctype[i] = 0; - - LINENO = 0; forceLower = false; + LINENO = 0; pushedBack = false; } @@ -70,6 +63,9 @@ case TT_NUMBER: printf("%ld: num: %d\n", lineno(), nval); break; + case TT_FLOAT: + printf("%ld: float: %f\n", lineno(), dval); + break; case TT_WORD: printf("%ld: word: %s\n", lineno(), sval.c_str()); break; @@ -182,6 +178,21 @@ break; c = read(); } + if (isParseFloats && c == '.') { + double fr = 0; + double pw = 0.1; + for (; ; ) { + c = read(); + if ('0' <= c && c <= '9') { + fr += (c - '0') * pw; + pw /= 10.0; + } else + break; + } + peekc = (char)c; + dval = neg ? -(v + fr) : (v + fr); + return ttype = TT_FLOAT; + } peekc = (char)c; nval = neg ? -v : v; return ttype = TT_NUMBER; @@ -412,6 +423,12 @@ } void Tokenizer::resetSyntax() { + eolIsSignificantP = false; + slashSlashCommentsP = false; + slashStarCommentsP = false; + noCRLFInQuoteP = false; + isParseFloats = false; + for (int i = 0; i < 256; i++) ctype[i] = 0; } |
From: Denis P. <dy...@us...> - 2004-11-05 05:09:52
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20229 Modified Files: IngitFile.h IngitHeader.h IngitTable.h PolishFormat.cpp common.h Log Message: Use pragma pack push/pop. Otherwise we expirience very nice effects... :-) Now cmap does not crash. Index: IngitHeader.h =================================================================== RCS file: /cvsroot/cmap/cmap/IngitHeader.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- IngitHeader.h 15 May 2004 03:36:46 -0000 1.6 +++ IngitHeader.h 5 Nov 2004 05:09:42 -0000 1.7 @@ -5,6 +5,10 @@ #include "common.h" +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + class IngitHeader { public: long LON_SouthWest; @@ -71,5 +75,9 @@ #endif ; +#ifdef _MSC_VER +#pragma pack(pop) +#endif + #endif // __CMAP_IH_H__ Index: IngitTable.h =================================================================== RCS file: /cvsroot/cmap/cmap/IngitTable.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IngitTable.h 5 May 2004 16:35:52 -0000 1.7 +++ IngitTable.h 5 Nov 2004 05:09:42 -0000 1.8 @@ -1,6 +1,10 @@ #ifndef __CMAP_IT_H__ #define __CMAP_IT_H__ +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + // Çàãðóçêà, Ðàçáîð òàáëèö class IngitTable { public: @@ -35,5 +39,9 @@ #endif ; +#ifdef _MSC_VER +#pragma pack(pop) +#endif + #endif // __CMAP_IT_H__ Index: IngitFile.h =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- IngitFile.h 16 May 2004 13:48:57 -0000 1.10 +++ IngitFile.h 5 Nov 2004 05:09:42 -0000 1.11 @@ -6,6 +6,10 @@ #include "common.h" #include "Geodesy.h" +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + typedef struct Objects { char type[1]; //Òèï îáúåêòà char _b2; // @@ -65,6 +69,11 @@ __attribute__ ((packed)) #endif ; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif + extern nam_cod *names_codif; extern unsigned short n_obj_codif; Index: common.h =================================================================== RCS file: /cvsroot/cmap/cmap/common.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- common.h 16 May 2004 03:37:46 -0000 1.11 +++ common.h 5 Nov 2004 05:09:42 -0000 1.12 @@ -13,7 +13,6 @@ #ifdef _MSC_VER #pragma warning(disable : 4103) -#pragma pack (1) #endif char DosToWin (BYTE char_dos); Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- PolishFormat.cpp 31 Oct 2004 09:06:39 -0000 1.38 +++ PolishFormat.cpp 5 Nov 2004 05:09:42 -0000 1.39 @@ -2,9 +2,9 @@ #include <string.h> #include <stdlib.h> +#include "parserImpl.h" #include "IngitFile.h" #include "IngitTable.h" -#include "parserImpl.h" #include "Geodesy.h" #include "cmap.h" |
From: Denis P. <dy...@us...> - 2004-10-31 09:06:50
|
Update of /cvsroot/cmap/libs/eval In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26307/eval Modified Files: eval.cpp evalImpl.h parser.h Log Message: Integrate eval to cmap. city var now an integer. Only 0 or 1 is used at the moment. WARNING: this version crashes for some unknown reason. Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/libs/eval/eval.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- eval.cpp 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ eval.cpp 31 Oct 2004 09:06:40 -0000 1.2 @@ -4,33 +4,33 @@ #include "eval.h" #include "evalImpl.h" -void IntAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); +void IntAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, rvalue->getValue(obj, op, numArray)); } -void IntPlusAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, lvalue->getValue(obj, o, numArray) + rvalue->getValue(obj, o, numArray)); +void IntPlusAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, lvalue->getValue(obj, op, numArray) + rvalue->getValue(obj, op, numArray)); } -void StringAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void StringAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, rvalue->getValue(obj, op)); } -void StringPlusAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, lvalue->getValue(obj, o) + rvalue->getValue(obj, o)); +void StringPlusAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, lvalue->getValue(obj, op) + rvalue->getValue(obj, op)); } -void BoolAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); +void BoolAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, rvalue->getValue(obj, op, numArray)); } -void KindAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void KindAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, rvalue->getValue(obj, op)); } -void Block::exec(const void *obj, ObjectProp &o, int numArray) { +void Block::exec(const void *obj, ObjectProp &op, int numArray) { for (Executable *a = first; a != NULL; a = a->next) - a->exec(obj, o, numArray); + a->exec(obj, op, numArray); } void Block::addAssign(Assign *a) { @@ -53,41 +53,40 @@ } } -void Case::exec(const void *obj, ObjectProp &o, int numArray) { - if (expr->getValue(obj, o, numArray)) - Block::exec(obj, o, numArray); +void Case::exec(const void *obj, ObjectProp &op, int numArray) { + if (expr->getValue(obj, op, numArray)) + Block::exec(obj, op, numArray); } -bool ObjectConf::handle(const void *obj, ObjectProp &o, int numArray) { - memset(&o, 0, sizeof(ObjectProp)); - o.garminType = -1; - o.typePoint = -1; - o.typeLine = -1; - o.typePoly = -1; - o.doExport = true; +bool ObjectConf::handle(const void *obj, ObjectProp &op, int numArray) { + op.garminType = -1; + op.typePoint = -1; + op.typeLine = -1; + op.typePoly = -1; + op.doExport = true; - init(obj, o); + init(obj, op); - block.exec(obj, o, numArray); + block.exec(obj, op, numArray); - if (!o.doExport) + if (!op.doExport) return false; - if (o.garminType != -1) + if (op.garminType != -1) return true; - switch (o.kind) { + switch (op.kind) { case kind::Point: - o.garminType = o.typePoint; + op.garminType = op.typePoint; break; case kind::Line: - o.garminType = o.typeLine; + op.garminType = op.typeLine; break; case kind::Polygon: - o.garminType = o.typePoly; + op.garminType = op.typePoly; break; default: - printf("Unknown object type: '%d'\n", o.kind); + printf("Unknown object type: '%d'\n", op.kind); exit(1); } Index: parser.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/parser.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- parser.h 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ parser.h 31 Oct 2004 09:06:40 -0000 1.2 @@ -40,7 +40,7 @@ KindLVar *parseKindLVar(const std::string &varName); KindExpr *parseKindExpr(); - SetVar *parseSetVar(const std::string &varName); + virtual SetVar *parseSetVar(const std::string &varName); void parseAssign(Block *b, const std::string &varName); void parseBlock(Block *b, ObjectConf *obj = NULL); @@ -52,7 +52,5 @@ Tokenizer &t; }; -void readConfig(const char *filename); - #endif // __CMAP_PARSER_H__ Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/evalImpl.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- evalImpl.h 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ evalImpl.h 31 Oct 2004 09:06:40 -0000 1.2 @@ -18,21 +18,21 @@ virtual ~StringExpr() { } - virtual std::string getValue(const void *obj, const ObjectProp &o) = 0; + virtual std::string getValue(const void *obj, const ObjectProp &op) = 0; }; class StringLVar : public StringExpr { public: - virtual void setValue(ObjectProp &o, const std::string &value) = 0; + virtual void setValue(ObjectProp &op, const std::string &value) = 0; }; class LabelLVar : public StringLVar { - virtual std::string getValue(const void *, const ObjectProp &o) { - return o.label; + virtual std::string getValue(const void *, const ObjectProp &op) { + return op.label; } - virtual void setValue(ObjectProp &o, const std::string &value) { - o.label = value; + virtual void setValue(ObjectProp &op, const std::string &value) { + op.label = value; } }; @@ -59,72 +59,72 @@ virtual ~IntExpr() { } - virtual int getValue(const void *obj, const ObjectProp &o, int numArray) = 0; + virtual int getValue(const void *obj, const ObjectProp &op, int numArray) = 0; }; class IntLVar : public IntExpr { public: - virtual int getValue(const void *obj, const ObjectProp &o, int numArray) = 0; - virtual void setValue(ObjectProp &o, int value) = 0; + virtual int getValue(const void *obj, const ObjectProp &op, int numArray) = 0; + virtual void setValue(ObjectProp &op, int value) = 0; }; class LayerMinVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.layerMin; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.layerMin; } - virtual void setValue(ObjectProp &o, int value) { - o.layerMin = value; + virtual void setValue(ObjectProp &op, int value) { + op.layerMin = value; } }; class LayerMaxVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.layerMax; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.layerMax; } - virtual void setValue(ObjectProp &o, int value) { - o.layerMax = value; + virtual void setValue(ObjectProp &op, int value) { + op.layerMax = value; } }; class PointVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.typePoint; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.typePoint; } - virtual void setValue(ObjectProp &o, int value) { - o.typePoint = value; + virtual void setValue(ObjectProp &op, int value) { + op.typePoint = value; } }; class LineVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.typeLine; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.typeLine; } - virtual void setValue(ObjectProp &o, int value) { - o.typeLine = value; + virtual void setValue(ObjectProp &op, int value) { + op.typeLine = value; } }; class PolygonVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.typePoly; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.typePoly; } - virtual void setValue(ObjectProp &o, int value) { - o.typePoly = value; + virtual void setValue(ObjectProp &op, int value) { + op.typePoly = value; } }; class TypeVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.garminType; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.garminType; } - virtual void setValue(ObjectProp &o, int value) { - o.garminType = value; + virtual void setValue(ObjectProp &op, int value) { + op.garminType = value; } }; @@ -155,7 +155,7 @@ } } - virtual void exec(const void *obj, ObjectProp &o, int numArray) = 0; + virtual void exec(const void *obj, ObjectProp &op, int numArray) = 0; Executable *next; }; @@ -179,12 +179,12 @@ delete rvalue; }; - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class StringPlusAssign : public StringAssign { public: - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class IntAssign : public Assign { @@ -197,12 +197,12 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class IntPlusAssign : public IntAssign { public: - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class BoolExpr { @@ -210,12 +210,12 @@ virtual ~BoolExpr() { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) = 0; + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) = 0; }; class BoolLVar : public BoolExpr { public: - virtual void setValue(ObjectProp &o, bool value) = 0; + virtual void setValue(ObjectProp &op, bool value) = 0; }; class BoolConst : public BoolExpr { @@ -231,32 +231,32 @@ }; class ExportVar : public BoolLVar { - virtual bool getValue(const void *, const ObjectProp &o, int) { - return o.doExport; + virtual bool getValue(const void *, const ObjectProp &op, int) { + return op.doExport; } - virtual void setValue(ObjectProp &o, bool value) { - o.doExport = value; + virtual void setValue(ObjectProp &op, bool value) { + op.doExport = value; } }; class IndexVar : public BoolLVar { - virtual bool getValue(const void *, const ObjectProp &o, int) { - return o.index; + virtual bool getValue(const void *, const ObjectProp &op, int) { + return op.index; } - virtual void setValue(ObjectProp &o, bool value) { - o.index = value; + virtual void setValue(ObjectProp &op, bool value) { + op.index = value; } }; class CityVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.city; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.city; } - virtual void setValue(ObjectProp &o, int value) { - o.city = value; + virtual void setValue(ObjectProp &op, int value) { + op.city = value; } }; @@ -269,8 +269,8 @@ delete expr; } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return !expr->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return !expr->getValue(obj, op, numArray); } BoolExpr *expr; @@ -286,7 +286,7 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class BinaryIntExpr : public BoolExpr { @@ -308,8 +308,8 @@ EQIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) == expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) == expr2->getValue(obj, op, numArray); } }; @@ -318,8 +318,8 @@ NEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) != expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) != expr2->getValue(obj, op, numArray); } }; @@ -328,8 +328,8 @@ GEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) >= expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) >= expr2->getValue(obj, op, numArray); } }; @@ -338,8 +338,8 @@ GTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) > expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) > expr2->getValue(obj, op, numArray); } }; @@ -348,8 +348,8 @@ LEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) <= expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) <= expr2->getValue(obj, op, numArray); } }; @@ -358,8 +358,8 @@ LTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) < expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) < expr2->getValue(obj, op, numArray); } }; @@ -382,8 +382,8 @@ EQStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) == expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) == expr2->getValue(obj, op); } }; @@ -392,8 +392,8 @@ NEStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) != expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) != expr2->getValue(obj, op); } }; @@ -424,8 +424,8 @@ InExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - int index = expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + int index = expr2->getValue(obj, op, numArray); // assert(index < 120); return expr1->getIn(obj, index); } @@ -436,8 +436,8 @@ NotInExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - int index = expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + int index = expr2->getValue(obj, op, numArray); // assert(index < 120); return !expr1->getIn(obj, index); } @@ -448,7 +448,7 @@ virtual ~KindExpr() { } - virtual Kind getValue(const void *obj, const ObjectProp &o) = 0; + virtual Kind getValue(const void *obj, const ObjectProp &op) = 0; }; class KindConst : public KindExpr { @@ -465,16 +465,16 @@ class KindLVar : public KindExpr { public: - virtual void setValue(ObjectProp &o, const Kind value) = 0; + virtual void setValue(ObjectProp &op, const Kind value) = 0; }; class KindVar : public KindLVar { - virtual Kind getValue(const void *, const ObjectProp &o) { - return o.kind; + virtual Kind getValue(const void *, const ObjectProp &op) { + return op.kind; } - virtual void setValue(ObjectProp &o, const Kind value) { - o.kind = value; + virtual void setValue(ObjectProp &op, const Kind value) { + op.kind = value; } }; @@ -488,7 +488,7 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int); + virtual void exec(const void *obj, ObjectProp &op, int); }; class BinaryKindExpr : public BoolExpr { @@ -510,8 +510,8 @@ EQKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) == expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) == expr2->getValue(obj, op); } }; @@ -520,8 +520,8 @@ NEKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) != expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) != expr2->getValue(obj, op); } }; @@ -540,7 +540,7 @@ } } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); void addAssign(Assign *a); void addCase(Case *a); @@ -557,7 +557,7 @@ delete expr; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); BoolExpr *expr; }; @@ -567,7 +567,7 @@ ObjectConf() : typePoint(-1), typeLine(-1), typePoly(-1), next(NULL) { } - bool handle(const void *obj, ObjectProp &o, int numArray); + bool handle(const void *obj, ObjectProp &op, int numArray); // std::string object_cod; // êîä @@ -580,7 +580,7 @@ ObjectConf *next; // virtual bool check(const void *obj) = 0; - virtual void init(const void *obj, ObjectProp &o) = 0; + virtual void init(const void *obj, ObjectProp &op) = 0; }; #endif |
From: Denis P. <dy...@us...> - 2004-10-31 09:06:49
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26307 Modified Files: PolishFormat.cpp cmap.cpp cmap.dsp topo.conf Added Files: object.h parserImpl.cpp parserImpl.h Removed Files: eval.cpp eval.h evalImpl.h parser.cpp parser.h Log Message: Integrate eval to cmap. city var now an integer. Only 0 or 1 is used at the moment. WARNING: this version crashes for some unknown reason. --- parser.h DELETED --- --- eval.h DELETED --- --- NEW FILE: parserImpl.cpp --- #include <stdio.h> #include "parserImpl.h" #include "object.h" #include "IngitFile.h" class AttrVar : public StringRVar { public: AttrVar(int _n) : n(_n) { } virtual std::string getValue(const void *obj, const ObjectProp &) { const h_object *o = (const h_object *)obj; if (o->atr_cod[n] == NULL) return ""; return o->atr_cod[n]; } int n; }; class IntAttrVar : public IntRVar { public: IntAttrVar(int _n) : n(_n) { } virtual int getValue(const void *obj, const ObjectProp &, int) { const h_object *o = (const h_object *)obj; if (o->atr_cod[n] == NULL) return 0; return strtol(o->atr_cod[n], NULL, 10); } int n; }; class SquareVar : public IntRVar { virtual int getValue(const void *obj, const ObjectProp &, int numArray) { const h_object *o = (const h_object *)obj; if (o->Cod[0] == 'A') return (int)SQU_area(numArray); return 0; } }; class LengthVar : public IntRVar { virtual int getValue(const void *obj, const ObjectProp &, int numArray) { const h_object *o = (const h_object *)obj; if (o->Cod[0] == 'A' || o->Cod[0] == 'L') return (int)LEN_area(numArray, false); return 0; } }; class AttrSetVar : public SetVar { public: virtual bool getIn(const void *obj, int index) { const h_object *o = (const h_object *)obj; return o->atr_cod[index] != NULL; } }; static ObjectConf *firstObj = NULL; static ObjectConf *lastObj = NULL; void addObjectConf(ObjectConfImpl *obj) { if (firstObj == NULL) { firstObj = obj; lastObj = obj; } else { lastObj->next = obj; lastObj = obj; } } void clearObjectConf() { while (firstObj != NULL) { lastObj = firstObj; firstObj = firstObj->next; delete lastObj; } lastObj = NULL; } static char const **warnedCODs = NULL; static size_t warnedCODpos = 0; static size_t warnedCODsize = 0; static bool checkWarned(const char *cod) { for (size_t i = 0; i < warnedCODpos; i++) if (strcmp(warnedCODs[i], cod) == 0) return true; if (warnedCODpos >= warnedCODsize) { warnedCODsize = (warnedCODs == NULL) ? 256 : warnedCODsize * 2; warnedCODs = (char const **)s_realloc(warnedCODs, warnedCODsize * sizeof(char *)); } warnedCODs[warnedCODpos++] = cod; return false; } void clearWarnedEval() { if (warnedCODs != NULL) s_free(warnedCODs); warnedCODs = NULL; warnedCODpos = 0; warnedCODsize = 0; } bool evalObjectProp(const h_object *obj, ObjectProp &op, int numArray) { ObjectConfImpl *objConf = (ObjectConfImpl *)firstObj; while (objConf != NULL) { if (strcmp(objConf->code.c_str(), obj->Cod + 1) == 0) return objConf->handle(obj, op, numArray); objConf = (ObjectConfImpl *)objConf->next; } ASSERT(obj->Cod[1] != 0); if (!checkWarned(obj->Cod + 1)) printf("Warning!!! Type not found in config: '%s'\n", obj->Cod + 1); return false; } void ObjectConfImpl::init(const void *obj, ObjectProp &op) { const h_object *object = (const h_object *)obj; op.index = 0; op.doExport = false; op.city = 0; op.layerMin = 0; op.layerMax = 0; switch (object->Cod[0]) { case 'P': op.kind = kind::Point; break; case 'L': op.kind = kind::Line; break; case 'A': op.kind = kind::Polygon; break; default: printf("Unknown object type: '%c'\n", object->Cod[0]); exit(1); } } ConfigParserImpl::ConfigParserImpl(Tokenizer &_t) : ConfigParser(_t) { } IntRVar *ConfigParserImpl::parseIntRVar(const std::string &varName) { IntRVar *var = ConfigParser::parseIntRVar(varName); if (var != NULL) return var; if (varName == "square") return new SquareVar(); if (varName == "length") return new LengthVar(); if ((varName.length() > 7) && (strncmp(varName.c_str(), "intattr", 7) == 0)) { // intattrNUM var char *err; long n = strtol(varName.c_str() + 7, &err, 10); if ((*err != 0) || (n > 110)) throw ParserException(("Unknown variable: " + varName).c_str()); return new IntAttrVar(n); } return NULL; } StringRVar *ConfigParserImpl::parseStringRVar(const std::string &varName) { StringRVar *var = ConfigParser::parseStringRVar(varName); if (var != NULL) return var; if ((varName.length() > 4) && (strncmp(varName.c_str(), "attr", 4) == 0)) { // attrNUM var char *err; long n = strtol(varName.c_str() + 4, &err, 10); if ((*err != 0) || (n > 110)) throw ParserException(("Unknown variable: " + varName).c_str()); return new AttrVar(n); } return NULL; } SetVar *ConfigParserImpl::parseSetVar(const std::string &varName) { if (varName == "attr") return new AttrSetVar(); return NULL; } void ConfigParserImpl::parseBlockStart(ObjectConf *) { } bool ConfigParserImpl::parseObject() { switch (t.nextToken()) { case TT_EOF: return false; case TT_WORD: break; default: throw ParserException("Expected 'file'"); } if (t.sval != "object") throw ParserException("Expected 'object'"); if (t.nextToken() != TT_STRING) throw ParserException("Expected object code"); if (t.sval.length() > 8) throw ParserException("Object code is longer than 8"); ObjectConfImpl *obj = new ObjectConfImpl(t.sval.c_str()); parseBlock(&obj->block, obj); addObjectConf(obj); return true; } void readConfig(const char *filename) { FILE *f = fopen(filename, "rt"); if (f == NULL) { fprintf(stderr, "File not found: %s\n", filename); exit(1); } Tokenizer t(f); t.lowerCaseMode(true); t.quoteChar('"'); t.wordChars('a', 'z'); t.wordChars('A', 'Z'); t.wordChar('_'); t.parseNumbers(); t.whitespaceChar(' '); t.whitespaceChar('\n'); t.whitespaceChar('\r'); t.whitespaceChar('\t'); t.slashSlashComments(true); t.slashStarComments(true); ConfigParserImpl p(t); try { while (p.parseObject()) ; } catch (ParserException &) { t.printToken(); fclose(f); throw; } fclose(f); } --- eval.cpp DELETED --- Index: cmap.dsp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.dsp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- cmap.dsp 31 Oct 2004 06:41:55 -0000 1.7 +++ cmap.dsp 31 Oct 2004 09:06:39 -0000 1.8 @@ -64,7 +64,7 @@ # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "eval" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "eval" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe @@ -93,7 +93,7 @@ # End Source File # Begin Source File -SOURCE=.\eval.cpp +SOURCE=.\eval\eval.cpp # End Source File # Begin Source File @@ -113,7 +113,11 @@ # End Source File # Begin Source File -SOURCE=.\parser.cpp +SOURCE=.\eval\parser.cpp +# End Source File +# Begin Source File + +SOURCE=.\parserImpl.cpp # End Source File # Begin Source File @@ -137,11 +141,11 @@ # End Source File # Begin Source File -SOURCE=.\eval.h +SOURCE=.\eval\eval.h # End Source File # Begin Source File -SOURCE=.\evalImpl.h +SOURCE=.\eval\evalImpl.h # End Source File # Begin Source File @@ -161,7 +165,15 @@ # End Source File # Begin Source File -SOURCE=.\parser.h +SOURCE=.\object.h +# End Source File +# Begin Source File + +SOURCE=.\eval\parser.h +# End Source File +# Begin Source File + +SOURCE=.\parserImpl.h # End Source File # Begin Source File --- NEW FILE: parserImpl.h --- #ifndef __CMAP_PARSERIMPL_H__ #define __CMAP_PARSERIMPL_H__ #include "parser.h" #include "IngitFile.h" class ConfigParserImpl : public ConfigParser { public: ConfigParserImpl(Tokenizer &_t); virtual IntRVar *parseIntRVar(const std::string &varName); virtual StringRVar *parseStringRVar(const std::string &varName); virtual SetVar *parseSetVar(const std::string &varName); virtual bool parseObject(); virtual void parseBlockStart(ObjectConf *obj); }; void readConfig(const char *filename); void clearObjectConf(); bool evalObjectProp(const h_object *obj, ObjectProp &op, int numArray); void clearWarnedEval(); #endif // __CMAP_PARSERIMPL_H__ --- parser.cpp DELETED --- Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- topo.conf 27 May 2004 11:30:00 -0000 1.9 +++ topo.conf 31 Oct 2004 09:06:40 -0000 1.10 @@ -1068,7 +1068,7 @@ layer_min = 0; layer_max = 3; label = attr9; - city = true; + city = 1; case intattr38 > 70000 { point = 0x4; } @@ -1092,7 +1092,7 @@ layer_min = 0; layer_max = 3; label = attr9; - city = true; + city = 1; case attr43 = "9" { point = 0x4; } @@ -1107,7 +1107,7 @@ layer_min = 0; layer_max = 2; label = attr9; - city = true; + city = 1; case attr43 = "9" { point = 0x4; } Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- PolishFormat.cpp 27 May 2004 11:30:00 -0000 1.37 +++ PolishFormat.cpp 31 Oct 2004 09:06:39 -0000 1.38 @@ -4,7 +4,7 @@ #include "IngitFile.h" #include "IngitTable.h" -#include "eval.h" +#include "parserImpl.h" #include "Geodesy.h" #include "cmap.h" @@ -120,7 +120,7 @@ WGS84SK42Projection WGS (1.0); printf("Writing file...\n"); - ObjectProp o; + ObjectProp op; for (unsigned short NumObj = 1; NumObj < Max_Num_OBJ; NumObj++) { if (Index_Atr[obj[NumObj].num] == 0) { // Skip deleted objects fprintf (outIMG, "; %s NUM_OBJ %i %s skipped\n", @@ -131,22 +131,22 @@ num_array = ReadMetric(NumObj, Maps, latSW, lonSW, latNE, lonNE); // Ïðîâåðêà íà EXPORT - if (!evalObjectProp(obj + NumObj, o, num_array)) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ + if (!evalObjectProp(obj + NumObj, op, num_array)) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ continue; - if (o.index) + if (op.index) RGN_point = 0x20; else RGN_point = 0x10; - Type_point = o.typePoint; - Type_line = o.typeLine; - Type_poly = o.typePoly; - img_Layer_max = o.layerMax; - img_Layer_min = o.layerMin; + Type_point = op.typePoint; + Type_line = op.typeLine; + Type_poly = op.typePoly; + img_Layer_max = op.layerMax; + img_Layer_min = op.layerMin; //if (img_Layer_max > 3 ) img_Layer_max = 3; - DosToWin(rus_name, (BYTE *)o.label.c_str()); + DosToWin(rus_name, (BYTE *)op.label.c_str()); if (num_array == 1) obj[NumObj].Cod[0] = 'P'; @@ -446,10 +446,10 @@ type_obj = obj[NumObj].Cod[0]; - if (o.city) + if (op.city != 0) type_obj = 'C'; else - switch (o.type) { + switch (op.kind) { case kind::Point: type_obj = 'P'; break; @@ -503,7 +503,7 @@ // Çàïðåò àâòîìàòè÷åñêîãî ðàçíîñà ïî ñëîÿì. if (comm_layer == 1) - img_Layer_max = o.layerMax; + img_Layer_max = op.layerMax; switch (type_obj) { // Ïðîâåðêà íà òèï îáúåêòà // Òî÷å÷íûé îáúåêò Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- cmap.cpp 25 May 2004 21:37:01 -0000 1.36 +++ cmap.cpp 31 Oct 2004 09:06:39 -0000 1.37 @@ -18,10 +18,9 @@ #endif #include "common.h" -#include "parser.h" +#include "parserImpl.h" #include "IngitFile.h" #include "PolishFormat.h" -#include "evalImpl.h" char cmapVersion[] = "cMap ver. 1.6b"; char cmapDescription[] = "Map data converter\n"; --- NEW FILE: object.h --- #ifndef __OBJECT_H__ #define __OBJECT_H__ #include "evalImpl.h" class ObjectConfImpl : public ObjectConf { public: ObjectConfImpl(const std::string &_code) : code(_code) { } virtual void init(const void *obj, ObjectProp &op); std::string code; }; #endif // __OBJECT_H__ --- evalImpl.h DELETED --- |
From: Denis P. <dy...@us...> - 2004-10-31 06:42:05
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1958 Modified Files: cmap.dsp Removed Files: tokenizer.cpp tokenizer.h Log Message: Use tokenizer from eval lib --- tokenizer.h DELETED --- Index: cmap.dsp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.dsp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- cmap.dsp 15 May 2004 18:43:12 -0000 1.6 +++ cmap.dsp 31 Oct 2004 06:41:55 -0000 1.7 @@ -64,7 +64,7 @@ # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "eval" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe @@ -121,7 +121,7 @@ # End Source File # Begin Source File -SOURCE=.\tokenizer.cpp +SOURCE=.\eval\tokenizer.cpp # End Source File # End Group # Begin Group "Header Files" @@ -169,7 +169,7 @@ # End Source File # Begin Source File -SOURCE=.\tokenizer.h +SOURCE=.\eval\tokenizer.h # End Source File # End Group # Begin Group "Resource Files" --- tokenizer.cpp DELETED --- |
From: Denis P. <dy...@us...> - 2004-10-31 06:26:10
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32164 Modified Files: history.txt Log Message: Spell Index: history.txt =================================================================== RCS file: /cvsroot/cmap/cmap/history.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- history.txt 31 Oct 2004 06:16:17 -0000 1.6 +++ history.txt 31 Oct 2004 06:25:57 -0000 1.7 @@ -16,7 +16,7 @@ êîíâåðòàöèè. ------------------------- - - ðåàëèçîâàí ìåõàíèçì îïèñàíèÿ ïðîöåññà êîâåðòàöèè ïðè ïîìîùè + - ðåàëèçîâàí ìåõàíèçì îïèñàíèÿ ïðîöåññà êîíâåðòàöèè ïðè ïîìîùè ôîðìàëüíîãî èìïåðàòèâíîãî ÿçûêà. --------------------------------------------------------------- |
From: Denis P. <dy...@us...> - 2004-10-31 06:16:31
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30665 Modified Files: history.txt Removed Files: PLAN.dbf TOPO.dbf Log Message: Remove not neccessary .dbf files. Update history.txt. Index: history.txt =================================================================== RCS file: /cvsroot/cmap/cmap/history.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- history.txt 4 May 2004 23:19:23 -0000 1.5 +++ history.txt 31 Oct 2004 06:16:17 -0000 1.6 @@ -6,6 +6,20 @@ --------------------------------------------------------------- +v. 2.0 +--------------------------------------------------------------- + + ------------------------- + !!! Ïàðàìåòðû êîíâåðòàöèè âûíåñåíû èç DBF â .conf ôàéëû. + Ýòî ïîçâîëèëî çíà÷èòåëüíî óâåëè÷èòü ãèáêîñòü êîíâåðòåðà. + Èñïîëüçóéòå dbf2conf, ÷òîáû ïðåîáðàçîâàòü ïàðàìåòðû + êîíâåðòàöèè. + ------------------------- + + - ðåàëèçîâàí ìåõàíèçì îïèñàíèÿ ïðîöåññà êîâåðòàöèè ïðè ïîìîùè + ôîðìàëüíîãî èìïåðàòèâíîãî ÿçûêà. + +--------------------------------------------------------------- v. 1.6 --------------------------------------------------------------- --- TOPO.dbf DELETED --- --- PLAN.dbf DELETED --- |
From: Denis P. <dy...@us...> - 2004-10-31 06:09:44
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29791 Modified Files: parser.cpp Log Message: Formatting Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- parser.cpp 27 May 2004 11:25:48 -0000 1.10 +++ parser.cpp 31 Oct 2004 06:09:32 -0000 1.11 @@ -456,8 +456,8 @@ t.slashSlashComments(true); try { - while (parseObject(t)) - ; + while (parseObject(t)) + ; } catch (ParserException &x) { printf("%s\n", x.what()); printToken(t); |
From: Denis P. <dy...@us...> - 2004-05-27 11:30:10
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8184 Modified Files: PolishFormat.cpp topo.conf Log Message: Use type var to remove code from PF.cpp to topo.conf. Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- topo.conf 17 May 2004 08:46:36 -0000 1.8 +++ topo.conf 27 May 2004 11:30:00 -0000 1.9 @@ -545,6 +545,7 @@ export = true; index = false; point = 0x6508; + type = point; layer_min = 0; layer_max = 1; label = attr9; @@ -557,7 +558,7 @@ export = true; index = false; point = 0x650E; - line = 0x1B; + type = point; layer_min = 0; layer_max = 0; label = attr9; @@ -994,7 +995,7 @@ export = true; index = false; point = 0x6406; - line = 0x1A; + type = point; layer_min = 0; layer_max = 2; label = "ïàðîì"; @@ -1022,7 +1023,7 @@ export = true; index = false; point = 0x6406; - line = 0x16; + type = point; layer_min = 0; layer_max = 1; label = "áðîä"; @@ -2795,7 +2796,7 @@ object "81111000" { export = true; line = 0x1C; - polygon = 0x03; + type = line; layer_min = 1; layer_max = 2; } Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- PolishFormat.cpp 27 May 2004 11:25:48 -0000 1.36 +++ PolishFormat.cpp 27 May 2004 11:30:00 -0000 1.37 @@ -269,15 +269,7 @@ strcat(rus_name, getAttr34Str((BYTE*)obj[NumObj].atr_cod[34])); } break; - case 33112000: // Ïàðîìû àâòîìîáèëüíûå - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'P'; - //img_Layer_max = 2; - break; case 33130000: // Áðîäû - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'P'; - //img_Layer_max = 1; // 34 Õàððàêòåð ãðóíòà if (obj[NumObj].atr_cod[34] != 0) { strcat(rus_name, " "); @@ -285,22 +277,6 @@ } //printf ("%s\n", rus_name); break; - case 31335100: // Âîäîïàäû - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'P'; - //img_Layer_max = 2; - break; - case 31335200: // Ïîðîãè - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'P'; - //img_Layer_max = 1; - break; - case 81111000: // Ðåãèîí - //img_Layer_max = 2; - //Type_line = 0x1c; - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'L'; - break; default: break; |
From: Denis P. <dy...@us...> - 2004-05-27 11:25:58
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7526 Modified Files: PolishFormat.cpp eval.cpp eval.h evalImpl.h parser.cpp plan.conf Log Message: Add Kind expressions and assignments. Add type variable to config. Use it in plan.conf. Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- parser.cpp 17 May 2004 08:46:36 -0000 1.9 +++ parser.cpp 27 May 2004 11:25:48 -0000 1.10 @@ -100,6 +100,12 @@ return NULL; } +KindLVar *parseKindLVar(const std::string &varName) { + if (varName == "type") + return new TypeLVar(); + return NULL; +} + BoolExpr *parseBoolVar(const std::string &varName) { BoolExpr *e = parseBoolLVar(varName); @@ -178,6 +184,28 @@ } } +KindExpr *parseKindExpr(Tokenizer &t) { + switch (t.nextToken()) { + case TT_WORD: + if (t.sval == "point") + return new KindConst(kind::Point); + else if (t.sval == "line") + return new KindConst(kind::Line); + else if (t.sval == "polygon") + return new KindConst(kind::Polygon); + else + throw ParserException("Type constant expected (point, line or polygon)"); + { + KindExpr *e = parseKindLVar(t.sval); + if (e != NULL) + return e; + throw ParserException(("Unknown variable: " + t.sval).c_str()); + } + default: + throw ParserException("Kind expression expected"); + } +} + SetVar *parseSetVar(const std::string &varName) { if (varName == "attr") return new AttrSetVar(); @@ -202,6 +230,7 @@ IntExpr *ie; StringExpr *se; SetVar *sv; + KindLVar *kv; if ((ie = parseIntVar(t.sval)) != NULL) { switch (t.nextToken()) { @@ -248,6 +277,17 @@ default: throw ParserException("Expected = or !="); } + } else if ((kv = parseKindLVar(t.sval)) != NULL) { + switch (t.nextToken()) { + case '=': + return new EQKindExpr(kv, parseKindExpr(t)); + case '!': + if (t.nextToken() != '=') + throw ParserException("Expect !="); + return new NEKindExpr(kv, parseKindExpr(t)); + default: + throw ParserException("Expected = or !="); + } } else throw ParserException(("Unknown variable: " + t.sval).c_str()); } @@ -296,28 +336,49 @@ StringLVar *sVar = parseStringLVar(varName); - if (sVar == NULL) + if (sVar != NULL) { + StringAssign *a; + switch (t.nextToken()) { + case '=': + a = new StringAssign(); + break; + case '+': + if (t.nextToken() != '=') + throw ParserException("Expected '+='"); + a = new StringPlusAssign(); + break; + default: + throw ParserException("Expected '=' or '+='"); + } + + a->rvalue = parseStringExpr(t); + a->lvalue = sVar; + if (a->rvalue == NULL) + throw ParserException("String expression expected"); + + b->addAssign(a); + return; + } + + KindLVar *kVar = parseKindLVar(varName); + + if (kVar == NULL) throw ParserException(("Unknown variable: " + varName).c_str()); - StringAssign *a; + KindAssign *a; switch (t.nextToken()) { case '=': - a = new StringAssign(); - break; - case '+': - if (t.nextToken() != '=') - throw ParserException("Expected '+='"); - a = new StringPlusAssign(); + a = new KindAssign(); break; default: - throw ParserException("Expected '=' or '+='"); + throw ParserException("Expected '='"); } - - a->rvalue = parseStringExpr(t); - a->lvalue = sVar; + + a->rvalue = parseKindExpr(t); + a->lvalue = kVar; if (a->rvalue == NULL) - throw ParserException("String expression expected"); - + throw ParserException("Kind expression expected"); + b->addAssign(a); } Index: eval.h =================================================================== RCS file: /cvsroot/cmap/cmap/eval.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- eval.h 16 May 2004 17:40:41 -0000 1.5 +++ eval.h 27 May 2004 11:25:48 -0000 1.6 @@ -5,24 +5,32 @@ #include "IngitFile.h" -typedef struct { - enum ObjectType { - POINT, - LINE, - POLYGON - } objectType; +namespace kind { + +typedef enum { + Point, + Line, + Polygon +} Kind; + +} + +typedef kind::Kind Kind; +typedef struct { bool index; bool doExport; bool city; - int type; + int garminType; int layerMin; int layerMax; std::string label; + Kind type; + //HACK until everything is cleaned out int typePoint; int typeLine; Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- PolishFormat.cpp 26 May 2004 21:53:13 -0000 1.35 +++ PolishFormat.cpp 27 May 2004 11:25:48 -0000 1.36 @@ -468,11 +468,25 @@ } // end switch(TYPE) } // êîíåö îáðàáîòêè òèïîâ îáúåêòîâ ïî àòðèáóòó 47 - if (o.city) - obj[NumObj].Cod[0] = 'C'; - type_obj = obj[NumObj].Cod[0]; + if (o.city) + type_obj = 'C'; + else + switch (o.type) { + case kind::Point: + type_obj = 'P'; + break; + case kind::Line: + type_obj = 'L'; + break; + case kind::Polygon: + type_obj = 'A'; + break; + default: + break; + } + // Îòáðàñûâàíèå îáúåêòîâ, äëÿ êîòîðûõ íå çàïîëíåíû ïîëÿ TYPE_X â DBF if (type_obj == 'P' && (RGN_point == -1 || Type_point == -1)) { // åñëè äëÿ ýòîãî âèäà îáúåêòà íå çàäàíî ïðåîáðàçîâàíèå if (!checkWarned(obj[NumObj].Cod)) Index: plan.conf =================================================================== RCS file: /cvsroot/cmap/cmap/plan.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- plan.conf 26 May 2004 21:53:13 -0000 1.4 +++ plan.conf 27 May 2004 11:25:48 -0000 1.5 @@ -109,6 +109,9 @@ layer_min = 0; layer_max = 3; label = attr1; + case type = polygon { + type = line; + } } // Ðå÷íàÿ (ìîðñêàÿ) ïðèñòàíü object "SP" { @@ -122,6 +125,7 @@ // Àâòîñòîÿíêè, ãàðàæè object "GA" { export = true; + point = 0x2f0b; polygon = 0x05; layer_min = 0; layer_max = 0; @@ -334,7 +338,7 @@ layer_min = 0; layer_max = 0; } -// Ýëåìåíò òîðîëîãèè ïðîåçäà +// Ýëåìåíò òîïîëîãèè ïðîåçäà object "TP" { export = false; layer_min = 0; @@ -427,6 +431,7 @@ object "AE" { export = true; index = false; + type = point; point = 0x5901; layer_min = 0; layer_max = 3; Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/eval.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- eval.cpp 16 May 2004 17:56:58 -0000 1.5 +++ eval.cpp 27 May 2004 11:25:48 -0000 1.6 @@ -89,6 +89,10 @@ lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); } +void KindAssign::exec(const h_object *obj, ObjectProp &o, int) { + lvalue->setValue(o, rvalue->getValue(obj, o)); +} + void Block::exec(const h_object *obj, ObjectProp &o, int numArray) { for (Assign *a = first; a != NULL; a = a->next) a->exec(obj, o, numArray); @@ -127,28 +131,40 @@ o.typeLine = -1; o.typePoly = -1; - block.exec(obj, o, numArray); - - if (!o.doExport) - return false; - switch (obj->Cod[0]) { case 'P': - o.type = o.typePoint; - o.objectType = ObjectProp::POINT; + o.type = kind::Point; break; case 'L': - o.type = o.typeLine; - o.objectType = ObjectProp::LINE; + o.type = kind::Line; break; case 'A': - o.type = o.typePoly; - o.objectType = ObjectProp::POLYGON; + o.type = kind::Polygon; break; default: printf("Unknown object type: '%c'\n", obj->Cod[0]); exit(1); } + block.exec(obj, o, numArray); + + if (!o.doExport) + return false; + + switch (o.type) { + case kind::Point: + o.garminType = o.typePoint; + break; + case kind::Line: + o.garminType = o.typeLine; + break; + case kind::Polygon: + o.garminType = o.typePoly; + break; + default: + printf("Unknown object type: '%c'\n", o.type); + exit(1); + } + return true; } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- evalImpl.h 25 May 2004 21:37:01 -0000 1.11 +++ evalImpl.h 27 May 2004 11:25:48 -0000 1.12 @@ -3,6 +3,11 @@ #include <string> #include <vector> +#include <string.h> + +#ifdef WIN32 +#define strcasecmp _stricmp +#endif #include "eval.h" #include "IngitFile.h" @@ -470,6 +475,88 @@ } }; +class KindExpr { +public: + virtual ~KindExpr() { + } + + virtual Kind getValue(const h_object *obj, const ObjectProp &o) = 0; +}; + +class KindConst : public KindExpr { +public: + KindConst(Kind _value) : value(_value) { + }; + + virtual Kind getValue(const h_object *, const ObjectProp &) { + return value; + } +protected: + Kind value; +}; + +class KindLVar : public KindExpr { +public: + virtual void setValue(ObjectProp &o, const Kind value) = 0; +}; + +class TypeLVar : public KindLVar { + virtual Kind getValue(const h_object *, const ObjectProp &o) { + return o.type; + } + + virtual void setValue(ObjectProp &o, const Kind value) { + o.type = value; + } +}; + +class KindAssign : public Assign { +public: + KindLVar *lvalue; + KindExpr *rvalue; + + virtual ~KindAssign() { + delete lvalue; + delete rvalue; + } + + virtual void exec(const h_object *obj, ObjectProp &o, int); +}; + +class BinaryKindExpr : public BoolExpr { +public: + BinaryKindExpr(KindExpr *_expr1, KindExpr *_expr2) : expr1(_expr1), expr2(_expr2) { + } + + virtual ~BinaryKindExpr() { + delete expr1; + delete expr2; + } + + KindExpr *expr1; + KindExpr *expr2; +}; + +class EQKindExpr : public BinaryKindExpr { +public: + EQKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int) { + return expr1->getValue(obj, o) == expr2->getValue(obj, o); + } +}; + +class NEKindExpr : public BinaryKindExpr { +public: + NEKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int) { + return expr1->getValue(obj, o) != expr2->getValue(obj, o); + } +}; + class Case; class Block { |
From: Denis P. <dy...@us...> - 2004-05-26 21:53:24
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2436 Modified Files: PolishFormat.cpp plan.conf Log Message: Fix label assignment Move all logic for plan to plan.conf Index: plan.conf =================================================================== RCS file: /cvsroot/cmap/cmap/plan.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- plan.conf 26 May 2004 21:41:55 -0000 1.3 +++ plan.conf 26 May 2004 21:53:13 -0000 1.4 @@ -349,7 +349,10 @@ polygon = 0x17; layer_min = 0; layer_max = 0; - label = attr1; + label = attr64; + case attr6 = "35" { + polygon = 0x6; + } } // Ýëåìåíòû çäàíèé, ñîîðóæåíèé object "EB" { Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- PolishFormat.cpp 17 May 2004 08:46:36 -0000 1.34 +++ PolishFormat.cpp 26 May 2004 21:53:13 -0000 1.35 @@ -166,7 +166,6 @@ sum_lon = 0; // Óñðåäíåííûå çíà÷åíèÿ êîîðäèíàò sum_lat = 0; - rus_name[0] = 0; if (Len_code != 2) COD = atoi (obj[NumObj].Cod + 1); @@ -307,26 +306,6 @@ break; } - // Ðàçáîð òèïîâ îáúåêòîâ ñ òîïîïëàíîâ - PLAN.DBF - if (Len_code == 2) { - // BL - Çäàíèå - if (strcmp("BL", obj[NumObj].Cod + 1) == 0) { - // àòðèáóò 06 "Íàçíà÷åíèå çäàíèÿ, ñîîðóæåíèÿ" - if (s_atoi (obj[NumObj].atr_cod[6]) > 0) { - switch (s_atoi (obj[NumObj].atr_cod[6])) { - case 35: // Ãàðàæ - Type_poly = 0x6; - break; - } - } - // àòðèáóò 64 "Ãîðîäñêîé àäðåñ" - DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[64]); - img_Layer_max = 0; - } else - // àòðèáóò 01 "Èìÿ (íîìåð) îáúåêòà, òåêñò" - DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[1]); - } - // Òîëüêî Äëÿ ÒÎÏÎ // Òèï îáúåêòà àòðèáóò 47 if (obj[NumObj].atr_cod[47] != 0 && Len_code == 8) { |
From: Denis P. <dy...@us...> - 2004-05-26 21:42:09
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv710 Modified Files: plan.conf Log Message: Add label assignment for plan Index: plan.conf =================================================================== RCS file: /cvsroot/cmap/cmap/plan.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- plan.conf 16 May 2004 04:41:00 -0000 1.2 +++ plan.conf 26 May 2004 21:41:55 -0000 1.3 @@ -4,6 +4,7 @@ polygon = 0x17; layer_min = 0; layer_max = 2; + label = attr1; } // Ãðàíèöà object "BC" { @@ -11,6 +12,7 @@ line = 0x1D; layer_min = 2; layer_max = 3; + label = attr1; } // Ëèíèÿ ãðàíèö äîðîã, ïðîåçæèõ ÷àñòåé object "BB" { @@ -28,6 +30,7 @@ polygon = 0x17; layer_min = 0; layer_max = 1; + label = attr1; } // Äâîð object "DW" { @@ -35,6 +38,7 @@ polygon = 0x17; layer_min = 0; layer_max = 1; + label = attr1; } // Îãðàæäåíèå object "GR" { @@ -51,6 +55,7 @@ polygon = 0x1A; layer_min = 0; layer_max = 0; + label = attr1; } // Ñòàäèîí, ñïîðòèâíàÿ ïëîùàäêà object "SR" { @@ -58,6 +63,7 @@ polygon = 0x19; layer_min = 0; layer_max = 0; + label = attr1; } // Êëàäáèùå object "BP" { @@ -67,6 +73,7 @@ polygon = 0x1A; layer_min = 0; layer_max = 0; + label = attr1; } // Ñòàíöèÿ ìåòðî object "UO" { @@ -75,6 +82,7 @@ point = 0x2700; layer_min = 0; layer_max = 1; + label = attr1; } // Ó÷àñòîê äîðîãè object "RD" { @@ -82,6 +90,7 @@ line = 0x05; layer_min = 0; layer_max = 1; + label = attr1; } // Òðàìâàéíàÿ ëèíèÿ object "RT" { @@ -89,6 +98,7 @@ line = 0x14; layer_min = 0; layer_max = 0; + label = attr1; } // Æåëåçíîäîðîæíàÿ ëèíèÿ object "RW" { @@ -98,6 +108,7 @@ line = 0x1B; layer_min = 0; layer_max = 3; + label = attr1; } // Ðå÷íàÿ (ìîðñêàÿ) ïðèñòàíü object "SP" { @@ -106,6 +117,7 @@ point = 0x2F09; layer_min = 0; layer_max = 0; + label = attr1; } // Àâòîñòîÿíêè, ãàðàæè object "GA" { @@ -113,6 +125,7 @@ polygon = 0x05; layer_min = 0; layer_max = 0; + label = attr1; } // Ðàéîí ìîðÿ, çàëèâ object "SE" { @@ -120,6 +133,7 @@ polygon = 0x28; layer_min = 0; layer_max = 0; + label = attr1; } // Îçåðî object "LK" { @@ -127,6 +141,7 @@ polygon = 0x3C; layer_min = 0; layer_max = 1; + label = attr1; } // Âîäîõðàíèëèùå object "LW" { @@ -135,6 +150,7 @@ polygon = 0x45; layer_min = 0; layer_max = 0; + label = attr1; } // Ïðóä object "RE" { @@ -142,6 +158,7 @@ polygon = 0x41; layer_min = 0; layer_max = 0; + label = attr1; } // Äåêîðàòèâíûé áàññåéí object "BA" { @@ -149,6 +166,7 @@ polygon = 0x3C; layer_min = 0; layer_max = 0; + label = attr1; } // Ðåêà object "RI" { @@ -157,6 +175,7 @@ polygon = 0x46; layer_min = 0; layer_max = 1; + label = attr1; } // Êàíàë object "CA" { @@ -165,6 +184,7 @@ polygon = 0x46; layer_min = 0; layer_max = 0; + label = attr1; } // Ðó÷åé object "RU" { @@ -173,6 +193,7 @@ polygon = 0x46; layer_min = 0; layer_max = 0; + label = attr1; } // Äðåâåñíàÿ ðàñòèòåëüíîñòü object "TZ" { @@ -182,6 +203,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Îòäåëüíûå äåðåâüÿ object "TR" { @@ -191,6 +213,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Âûðóáêà object "VR" { @@ -200,6 +223,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Êóëüòóðíàÿ ðàñòèòåëüíîñòü, ñàäû object "CZ" { @@ -209,6 +233,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Êóñàðíèêîâàÿ ðàñòèåëüíîñòü object "BZ" { @@ -218,6 +243,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Òðàâÿíàÿ ðàñòèòåëüíîñòü object "DZ" { @@ -227,6 +253,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Ïàðíèêè, îðàíæåðåè, òåïëèöû object "PR" { @@ -236,6 +263,7 @@ polygon = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Ïðîñåêè object "PC" { @@ -243,6 +271,7 @@ line = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } // Òåêñò object "TX" { @@ -275,6 +304,7 @@ point = 0x6300; layer_min = 0; layer_max = 0; + label = attr1; } // Ðåïåð object "RP" { @@ -295,6 +325,7 @@ polygon = 0x17; layer_min = 1; layer_max = 1; + label = attr1; } // Ëèíèÿ ïðîåêòèðóåìîé çàñòðîéêè object "BO" { @@ -318,6 +349,7 @@ polygon = 0x17; layer_min = 0; layer_max = 0; + label = attr1; } // Ýëåìåíòû çäàíèé, ñîîðóæåíèé object "EB" { @@ -350,6 +382,7 @@ point = 0x2C04; layer_min = 0; layer_max = 0; + label = attr1; } // Ôîíòàí object "WC" { @@ -358,6 +391,7 @@ point = 0x6511; layer_min = 0; layer_max = 0; + label = attr1; } // Ëåñòíèöà object "SW" { @@ -384,6 +418,7 @@ point = 0x2F04; layer_min = 0; layer_max = 0; + label = attr1; } // Àýðîäðîìû object "AE" { @@ -392,6 +427,7 @@ point = 0x5901; layer_min = 0; layer_max = 3; + label = attr1; } // Íîìåð äîðîãè object "RN" { @@ -406,6 +442,7 @@ point = 0x2000; layer_min = 0; layer_max = 2; + label = attr1; } // Òóííåëü object "TU" { @@ -413,6 +450,7 @@ polygon = 0x0C; layer_min = 0; layer_max = 0; + label = attr1; } // Ìîñò object "BR" { @@ -423,6 +461,7 @@ polygon = 0x0C; layer_min = 0; layer_max = 1; + label = attr1; } // Ïðîåçä â àðêå object "AR" { @@ -461,6 +500,7 @@ polygon = 0x4C; layer_min = 0; layer_max = 0; + label = attr1; } // Ïëîòèíà object "PL" { @@ -468,6 +508,7 @@ line = 0x1A; layer_min = 0; layer_max = 0; + label = attr1; } // Äàìáà object "DA" { @@ -481,6 +522,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr1; } // Øëþçû object "SL" { @@ -494,6 +536,7 @@ line = 0x28; layer_min = 0; layer_max = 0; + label = attr1; } // Èñòî÷íèêè, êîëîäöû object "IS" { @@ -579,6 +622,7 @@ line = 0x22; layer_min = 0; layer_max = 0; + label = attr1; } // Èçîáàòà object "BT" { @@ -586,6 +630,7 @@ line = 0x25; layer_min = 0; layer_max = 0; + label = attr1; } // Ôîðìû ðåëúåôà object "RF" { @@ -667,6 +712,7 @@ point = 0x2F01; layer_min = 0; layer_max = 0; + label = attr1; } // Îòäåëüíûå öèñòåðíû object "CI" { @@ -728,6 +774,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr1; } // Õàðàêòåðèñòèêà ðàñòèòåëüíîñòè object "FV" { @@ -809,4 +856,5 @@ line = 0x16; layer_min = 0; layer_max = 0; + label = attr1; } |
From: Denis P. <dy...@us...> - 2004-05-25 21:37:14
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1444 Modified Files: cmap.cpp evalImpl.h Log Message: Delete config when done Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- cmap.cpp 17 May 2004 16:02:06 -0000 1.35 +++ cmap.cpp 25 May 2004 21:37:01 -0000 1.36 @@ -21,6 +21,7 @@ #include "parser.h" #include "IngitFile.h" #include "PolishFormat.h" +#include "evalImpl.h" char cmapVersion[] = "cMap ver. 1.6b"; char cmapDescription[] = "Map data converter\n"; @@ -560,6 +561,8 @@ s_free(names_codif); s_free(names_gt1); + clearObjectConf(); + printf("Points......%i\n", N_Points); printf("Polylines...%i\n", N_Poliline); printf("Polygons....%i\n", N_Poligon); Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- evalImpl.h 23 May 2004 06:27:21 -0000 1.10 +++ evalImpl.h 25 May 2004 21:37:01 -0000 1.11 @@ -10,6 +10,9 @@ class StringExpr { public: + virtual ~StringExpr() { + } + virtual std::string getValue(const h_object *obj, const ObjectProp &o) = 0; }; @@ -33,6 +36,9 @@ StringConst(const std::string &_value) : value(_value) { } + virtual ~StringConst() { + } + virtual std::string getValue(const h_object *, const ObjectProp &) { return value; } @@ -59,6 +65,9 @@ class IntExpr { public: + virtual ~IntExpr() { + } + virtual int getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; }; @@ -168,6 +177,13 @@ Assign() : next(NULL) { } + virtual ~Assign() { + if (next != NULL) { + delete next; + next = NULL; + } + } + virtual void exec(const h_object *obj, ObjectProp &o, int numArray) = 0; Assign *next; @@ -178,6 +194,11 @@ StringLVar *lvalue; StringExpr *rvalue; + virtual ~StringAssign() { + delete lvalue; + delete rvalue; + }; + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; @@ -191,6 +212,11 @@ IntLVar *lvalue; IntExpr *rvalue; + virtual ~IntAssign() { + delete lvalue; + delete rvalue; + } + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; @@ -201,6 +227,9 @@ class BoolExpr { public: + virtual ~BoolExpr() { + } + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; }; @@ -256,6 +285,10 @@ NotExpr(BoolExpr *_expr) : expr(_expr) { } + virtual ~NotExpr() { + delete expr; + } + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { return !expr->getValue(obj, o, numArray); } @@ -268,6 +301,11 @@ BoolLVar *lvalue; BoolExpr *rvalue; + virtual ~BoolAssign() { + delete lvalue; + delete rvalue; + } + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; @@ -276,6 +314,11 @@ BinaryIntExpr(IntExpr *_expr1, IntExpr *_expr2) : expr1(_expr1), expr2(_expr2) { } + virtual ~BinaryIntExpr() { + delete expr1; + delete expr2; + } + IntExpr *expr1; IntExpr *expr2; }; @@ -345,6 +388,11 @@ BinaryStringExpr(StringExpr *_expr1, StringExpr *_expr2) : expr1(_expr1), expr2(_expr2) { } + virtual ~BinaryStringExpr() { + delete expr1; + delete expr2; + } + StringExpr *expr1; StringExpr *expr2; }; @@ -389,6 +437,11 @@ BinarySetExpr(SetVar *_expr1, IntExpr *_expr2) : expr1(_expr1), expr2(_expr2) { } + ~BinarySetExpr() { + delete expr1; + delete expr2; + } + SetVar *expr1; IntExpr *expr2; }; @@ -424,6 +477,20 @@ Block() : first(NULL), last(NULL), firstCase(NULL), lastCase(NULL) { } + virtual ~Block() { + if (first != NULL) { + delete first; + first = NULL; + last = NULL; + } + + if (firstCase != NULL) { + delete (Block *)firstCase; + firstCase = NULL; + lastCase = NULL; + } + } + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); void addAssign(Assign *a); void addCase(Case *a); @@ -440,6 +507,14 @@ Case(BoolExpr *_expr) : Block(), expr(_expr), next(NULL) { } + virtual ~Case() { + delete expr; + if (next != NULL) { + delete next; + next = NULL; + } + } + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); BoolExpr *expr; |
From: Denis P. <dy...@us...> - 2004-05-23 06:27:30
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3458 Modified Files: Geodesy.cpp Geodesy.h evalImpl.h Log Message: Replace SQU_area & LEN_area with new functions by Alexander Gorbachev <al...@ma...>. Index: Geodesy.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Geodesy.cpp 16 May 2004 11:07:42 -0000 1.8 +++ Geodesy.cpp 23 May 2004 06:27:21 -0000 1.9 @@ -23,38 +23,151 @@ // Âû÷èñëåíèå ïëîùàäè ïîëèãîíà double SQU_area (int n) { double area = 0; + double area_s = 0; + double area_d = 0; double x, y; double x1, y1; - - for (int i = 0; i < n - 1; i++) { - x = Metr_OBJ[i].Lon * Kx; - y = Metr_OBJ[i].Lat * Ky; - x1 = Metr_OBJ[i + 1].Lon * Kx; - y1 = Metr_OBJ[i + 1].Lat * Ky; - - area += ((y + y1) * (x - x1)) / 2; - } - + + bool segment = true; + + for (int i = 0; i < n; i++) { + // printf("%3i [0x%X] --- ", i, Metr_OBJ[i].type); + switch (Metr_OBJ[i].type) { + case 0x80: // Íà÷àëî ñåãìåíòà + case 0xA0: //====================================== + case 0xC0: //====================================== + area += fabs(area_s); // Äîáàâëÿåì ñåãìåíò ê ïëîùàäè + area -= fabs(area_d); // Âû÷åòàåì äûðêó èç ïëîùàäè + area_s = 0; // Ñáðàñûâàåì íàêîïèòåëü ïëîùàäè ñåãìåíòà + area_d = 0; // Ñáðàñûâàåì íàêîïèòåëü ïëîùàäè äûðêè + + x = Metr_OBJ[i].Lon * Kx; + y = Metr_OBJ[i].Lat * Ky; + segment = true; + //printf("start seg x=%f y=%f\n", x, y); + continue; + + case 0: // Ïðîäîëæåíèå ñåãìåíòà + case 0x20: // Ïðîäîëæåíèå ñåãìåíòà (ïîâ¸ðíóò) + x1 = Metr_OBJ[i].Lon * Kx; + y1 = Metr_OBJ[i].Lat * Ky; + + if (segment) + area_s += ((y + y1) * (x - x1)) /2; + else + area_d += ((y + y1) * (x - x1)) /2; + x = x1; + y = y1; + + /* + if (segment) + printf("count seg %f x1=%f y1=%f\n", area_s, x1, y1); + else + printf("count dyr %f x1=%f y1=%f\n", area_d, x1, y1); + */ + continue; + + case 0x60: // Äûðêà (ïîâ¸ðíóòà) + case 0x40: // Äûðêà + area -= fabs(area_d); // Âû÷åòàåì äûðêó èç ïëîùàäè + area += fabs(area_s); // Äîáàâëÿåì ñåãìåíò ê ïëîùàäè + area_s = 0; // Ñáðàñûâàåì íàêîïèòåëü ïëîùàäè ñåãìåíòà + area_d = 0; // Ñáðàñûâàåì íàêîïèòåëü ïëîùàäè äûðêè + + x = Metr_OBJ[i].Lon * Kx; + y = Metr_OBJ[i].Lat * Ky; + segment = false; + + //printf("start dyr x=%f y=%f\n", x, y); + continue; + + default: //====================================== + printf ("Warning, unknown segment\n"); + continue; + } + } // Êîíåö öèêëà âûáîðêè ìàññèâà êîîðäèíàò + + area -= fabs(area_d); // Âû÷åòàåì ïîñëåäíþþ äûðêó èç ïëîùàäè + area += fabs(area_s); // Äîáàâëÿåì ïîñëåäíèé ñåãìåíò ê ïëîùàäè + + //printf ("Return squea=%.1f km2\n", area / 1000000.); return area; } // Âû÷èñëåíèå äëèíû ïîëèãîíà -double LEN_area (int n) { +double LEN_area(int n, bool d) { double x, y; double x1, y1; double len = 0; + double len_s = 0; + double len_d = 0; - for (int i = 0; i < n - 1; i++) { - if (Metr_OBJ[i].type != 0 && i > 0) - break; - x = Metr_OBJ[i].Lon * Kx; - y = Metr_OBJ[i].Lat * Ky; - x1 = Metr_OBJ[i + 1].Lon * Kx; - y1 = Metr_OBJ[i + 1].Lat * Ky; + enum { + TP_NOTHING, + TP_HOLE, + TP_SEGMENT + } typ = TP_NOTHING; - len += sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1) ); - } + for (int i = 0; i < n; i++) { + // printf("%3i [0x%X] --- ", i, Metr_OBJ[i].type); + switch (Metr_OBJ[i].type) { + case 0x80: // Íà÷àëî ñåãìåíòà + case 0xA0: //====================================== + case 0xC0: //====================================== + if (typ == TP_SEGMENT) + len_s += len; // Ñóìèðóåì ñåãìåíòû + else if (typ == TP_HOLE) + len_d = len; // Ñóìèðóåì äûðêè + len = 0; // Ñáðàñûâàåì íàêîïèòåëü äëèííû + x = Metr_OBJ[i].Lon * Kx; + y = Metr_OBJ[i].Lat * Ky; + + typ = TP_SEGMENT; + //printf("start seg x=%f y=%f\n", x, y); + continue; + + case 0: // Ïðîäîëæåíèå ñåãìåíòà + case 0x20: // Ïðîäîëæåíèå ñåãìåíòà (ïîâ¸ðíóò) + x1 = Metr_OBJ[i].Lon * Kx; + y1 = Metr_OBJ[i].Lat * Ky; + + len += sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)); + + x = x1; + y = y1; + continue; + + case 0x60: // Äûðêà (ïîâ¸ðíóòà) + case 0x40: // Äûðêà + if (typ == TP_SEGMENT) + len_s += len; // Ñóìèðóåì ñåãìåíòû + else if (typ == TP_HOLE) + len_d = len; // Ñóìèðóåì äûðêè + len = 0; // Ñáðàñûâàåì íàêîïèòåëü äëèííû + + x = Metr_OBJ[i].Lon * Kx; + y = Metr_OBJ[i].Lat * Ky; + typ = TP_HOLE; + + //printf("start hole x=%f y=%f\n", x, y); + continue; + + default: //====================================== + printf ("Warning, NEW segment code\n"); + continue; + } + } // Êîíåö öèêëà âûáîðêè ìàññèâà êîîðäèíàò + + if (typ == TP_SEGMENT) + len_s += len; // Ñóìèðóåì ïîñëåäíèé ñåãìåíò + else if (typ == TP_HOLE) + len_d = len; // Ñóìèðóåì ïîñëåäíþþ äûðêó + + len = len_s; + if (d) + len += len_d; // Ïðèáàâëÿåì äëèíó äûðîê + return len; } Index: Geodesy.h =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Geodesy.h 16 May 2004 12:20:40 -0000 1.7 +++ Geodesy.h 23 May 2004 06:27:21 -0000 1.8 @@ -8,7 +8,7 @@ const double E = log(1.); double SQU_area(int n); -double LEN_area(int n); +double LEN_area(int n, bool d); double IngitLat2Degrees(long degrees); double IngitLon2Degrees(long degrees, bool start); Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- evalImpl.h 17 May 2004 16:02:06 -0000 1.9 +++ evalImpl.h 23 May 2004 06:27:21 -0000 1.10 @@ -132,7 +132,7 @@ class LengthVar : public IntRVar { virtual int getValue(const h_object *, const ObjectProp &o, int numArray) { if (obj->Cod[0] == 'A' || obj->Cod[0] == 'L') - return (int)LEN_area(numArray); + return (int)LEN_area(numArray, false); return 0; } }; |
From: Denis P. <dy...@us...> - 2004-05-17 16:02:20
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26204 Modified Files: Makefile cmap.cpp evalImpl.h parser.h tokenizer.cpp tokenizer.h Log Message: Cleanups. Compile on Linux. Index: tokenizer.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tokenizer.cpp 16 May 2004 17:19:39 -0000 1.4 +++ tokenizer.cpp 17 May 2004 16:02:06 -0000 1.5 @@ -60,11 +60,11 @@ } void Tokenizer::commentChar(char c) { - ctype[c] |= CT_COMMENT; + ctype[(int)(unsigned char)c] |= CT_COMMENT; } void Tokenizer::wordChar(char c) { - ctype[c] |= CT_ALPHA; + ctype[(int)(unsigned char)c] |= CT_ALPHA; } void Tokenizer::eolIsSignificant(bool b) { @@ -338,7 +338,7 @@ len = sval.length(); if (len == 0) break; - if ((ctype[sval[(unsigned int)len - 1]] & CT_WHITESPACE) == 0) + if ((ctype[(int)(unsigned char)sval[(unsigned int)len - 1]] & CT_WHITESPACE) == 0) break; sval.resize(len); } @@ -350,7 +350,7 @@ } void Tokenizer::ordinaryChar(char c) { - ctype[c] = 0; + ctype[(int)(unsigned char)c] = 0; } void Tokenizer::ordinaryChars(int a, int b) { @@ -370,7 +370,7 @@ void Tokenizer::parseNumbers() { for (int i = '0'; i <= '9'; i++) ctype[i] |= CT_DIGIT; - ctype['-'] |= CT_DIGIT; + ctype[(int)(unsigned char)'-'] |= CT_DIGIT; } void Tokenizer::pushBack() { @@ -394,14 +394,11 @@ } void Tokenizer::quoteChar(char c) { - ctype[c] |= CT_QUOTE; + ctype[(int)(unsigned char)c] |= CT_QUOTE; } void Tokenizer::clearChar(char a) { - if (a < 0) - a = 0; - - ctype[a] = 0; + ctype[(int)(unsigned char)a] = 0; } void Tokenizer::whitespaceChars(int a, int b) { Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- evalImpl.h 17 May 2004 08:46:36 -0000 1.8 +++ evalImpl.h 17 May 2004 16:02:06 -0000 1.9 @@ -15,7 +15,7 @@ class StringLVar : public StringExpr { public: - virtual void setValue(ObjectProp &o, std::string &value) = 0; + virtual void setValue(ObjectProp &o, const std::string &value) = 0; }; class LabelLVar : public StringLVar { @@ -23,7 +23,7 @@ return o.label; } - virtual void setValue(ObjectProp &o, std::string &value) { + virtual void setValue(ObjectProp &o, const std::string &value) { o.label = value; } }; @@ -437,7 +437,7 @@ class Case : public Block { public: - Case(BoolExpr *_expr) : Block(), next(NULL), expr(_expr) { + Case(BoolExpr *_expr) : Block(), expr(_expr), next(NULL) { } virtual void exec(const h_object *obj, ObjectProp &o, int numArray); Index: tokenizer.h =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tokenizer.h 16 May 2004 17:19:39 -0000 1.4 +++ tokenizer.h 17 May 2004 16:02:06 -0000 1.5 @@ -6,7 +6,7 @@ #include <string> #include <exception> -class TokenizerException : public exception { +class TokenizerException : public std::exception { public: TokenizerException(const char *_msg); virtual ~TokenizerException() throw (); @@ -17,7 +17,7 @@ const char *msg; }; -class IOException : public exception { +class IOException : public std::exception { public: IOException(); virtual ~IOException() throw (); Index: parser.h =================================================================== RCS file: /cvsroot/cmap/cmap/parser.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- parser.h 15 May 2004 17:49:33 -0000 1.1 +++ parser.h 17 May 2004 16:02:06 -0000 1.2 @@ -3,7 +3,7 @@ #include <exception> -class ParserException : public exception { +class ParserException : public std::exception { public: ParserException(const char *_msg); virtual ~ParserException() throw (); Index: Makefile =================================================================== RCS file: /cvsroot/cmap/cmap/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 5 May 2004 10:38:16 -0000 1.4 +++ Makefile 17 May 2004 16:02:06 -0000 1.5 @@ -1,8 +1,8 @@ cmap_SOURCES = Geodesy.cpp IngitFile.cpp IngitHeader.cpp IngitTable.cpp \ - PolishFormat.cpp cmap.cpp dbf.cpp common.cpp + PolishFormat.cpp cmap.cpp common.cpp parser.cpp tokenizer.cpp eval.cpp cmap_HEADERS = Geodesy.h IngitFile.h IngitHeader.h IngitTable.h \ - PolishFormat.h cmap.h common.h dbf.h + PolishFormat.h cmap.h common.h parser.h tokenizer.h eval.h evalImpl.h all: cmap Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- cmap.cpp 15 May 2004 18:43:12 -0000 1.34 +++ cmap.cpp 17 May 2004 16:02:06 -0000 1.35 @@ -96,7 +96,8 @@ fprintf(outIMG, ";\n; Created by %s\n;\n\n\n", cmapVersion); if (NameMap[0] != '.') { - for (unsigned int i = 0; NameMap[i] == '.' || NameMap[i] == 0 ; i++) + unsigned int i; + for (i = 0; NameMap[i] == '.' || NameMap[i] == 0 ; i++) ; NameMap[i] = 0; } |
From: Denis P. <dy...@us...> - 2004-05-17 08:46:47
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28016 Modified Files: PolishFormat.cpp evalImpl.h parser.cpp topo.conf Log Message: - add intattrNUM (attr values converted to integer) - remove all empty case values from PolishFormat - adjust topo.conf Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- parser.cpp 16 May 2004 17:56:58 -0000 1.8 +++ parser.cpp 17 May 2004 08:46:36 -0000 1.9 @@ -84,6 +84,13 @@ return new SquareVar(); if (varName == "length") return new LengthVar(); + if ((varName.length() > 7) && (strncmp(varName.c_str(), "intattr", 7) == 0)) { // intattrNUM var + char *err; + long n = strtol(varName.c_str() + 7, &err, 10); + if ((*err != 0) || (n > 110)) + throw ParserException(("Unknown variable: " + varName).c_str()); + return new IntAttrVar(n); + } return NULL; } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- evalImpl.h 16 May 2004 17:56:58 -0000 1.7 +++ evalImpl.h 17 May 2004 08:46:36 -0000 1.8 @@ -137,6 +137,20 @@ } }; +class IntAttrVar : public IntRVar { +public: + IntAttrVar(int _n) : n(_n) { + } + + virtual int getValue(const h_object *obj, const ObjectProp &, int) { + if (obj->atr_cod[n] == NULL) + return 0; + return strtol(obj->atr_cod[n], NULL, 10); + } + + int n; +}; + class IntConst : public IntExpr { public: IntConst(int _value) : value(_value) { Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- topo.conf 16 May 2004 17:56:58 -0000 1.7 +++ topo.conf 17 May 2004 08:46:36 -0000 1.8 @@ -123,6 +123,7 @@ polygon = 0x4D; layer_min = 0; layer_max = 1; + label = attr9; } // Ôèðíîâûå ïîëÿ object "22120000" { @@ -130,6 +131,7 @@ polygon = 0x4D; layer_min = 0; layer_max = 0; + label = attr9; } // Ëåäíèêîâûå òðåùèíû object "22130000" { @@ -180,6 +182,7 @@ polygon = 0x4C; layer_min = 0; layer_max = 0; + label = attr9; } // Êîòëîâèíû âûñîõøèõ îçåð object "22222000" { @@ -188,6 +191,7 @@ polygon = 0x4C; layer_min = 0; layer_max = 0; + label = attr9; } // Âàëû áåðåãîâûå èñòîðè÷. è äð. object "22230000" { @@ -249,6 +253,7 @@ point = 0x6608; layer_min = 0; layer_max = 0; + label = attr9; } // Êðàòåðû îáû÷íûõ âóëêàíîâ object "22422000" { @@ -257,6 +262,7 @@ point = 0x6608; layer_min = 0; layer_max = 3; + label = attr9; } // Ëàâîâûå ïîòîêè object "22431000" { @@ -266,6 +272,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr9; } // Ëàâîâûå ïîêðîâû object "22432000" { @@ -275,6 +282,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr9; } // Íàëåäè object "22510000" { @@ -282,6 +290,7 @@ polygon = 0x4D; layer_min = 0; layer_max = 0; + label = attr9; } // Êóðãàíû object "22521000" { @@ -416,6 +425,7 @@ polygon = 0x40; layer_min = 0; layer_max = 0; + label = attr9; } // Ïëîùàäè ðàçëèâîâ (çîíû çàòîï. object "31140000" { @@ -613,6 +623,7 @@ line = 0x15; layer_min = 0; layer_max = 0; + label = attr9; } // Íàïðàâëåíèå îñíîâíîãî òå÷åíèÿ object "31521000" { @@ -668,6 +679,7 @@ point = 0x6511; layer_min = 0; layer_max = 1; + label = attr9; } // Èñòî÷íèêè íåîáîðóäîâàííûå object "31612000" { @@ -684,6 +696,7 @@ point = 0x6509; layer_min = 0; layer_max = 3; + label = attr9; } // Êîëîäöû àðòåçèàíñêèå object "31631000" { @@ -700,6 +713,7 @@ point = 0x5000; layer_min = 0; layer_max = 1; + label = attr9; } // Êîëîäöû áåòîíèð.ñ ìåõ.ïîäúåìî object "31633000" { @@ -708,12 +722,14 @@ point = 0x5000; layer_min = 0; layer_max = 1; + label = attr9; } // ×èãèðè object "31634000" { export = true; layer_min = 0; layer_max = 1; + label = attr9; } // Êîëîäöû ïðî÷èå object "31635000" { @@ -722,6 +738,7 @@ point = 0x5000; layer_min = 0; layer_max = 1; + label = attr9; } // Êîëîäöû ãëàâíûå object "31636000" { @@ -730,6 +747,7 @@ point = 0x5000; layer_min = 0; layer_max = 1; + label = attr9; } // Àðòåçèàíñêèå ñêâàæèíû object "31640000" { @@ -746,6 +764,7 @@ point = 0x5000; layer_min = 0; layer_max = 0; + label = attr9; } // Áåðåãîâàÿ ëèíèÿ object "31700000" { @@ -786,6 +805,7 @@ point = 0x5500; layer_min = 0; layer_max = 0; + label = attr9; } // Äàìáû è èñêóññòâåííûå âàëû object "32130000" { @@ -813,24 +833,28 @@ export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ñóõèå äîêè object "32210000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ñëèïû è ñòàïåëè object "32220000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ìîëû è ïðè÷àëû object "32230000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ïðèñòàíè ñ îáîðóä. ïðè÷àëàìè object "32240000" { @@ -855,6 +879,7 @@ export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Âîäîïðîâîäû object "32310000" { @@ -868,30 +893,35 @@ export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Àêâåäóêè object "32330000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Âîäîðàñïðåäåëèò. óñòðîéñòâà object "32340000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Äþêåðû íà ëèíèÿõ âîäîïðîâîäîâ object "32350000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Øàõò.ñòâîëû íà ïîäçåìí.êàíàëà object "32360000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ìàÿêè object "32410000" { @@ -908,6 +938,7 @@ point = 0x1B06; layer_min = 0; layer_max = 0; + label = attr9; } // Ïîñò.çíàêè áåðåã.ðå÷.ñèã-öèè object "32430000" { @@ -916,6 +947,7 @@ point = 0x1B06; layer_min = 0; layer_max = 0; + label = attr9; } // Ïëàâó÷èå ìàÿêè è îãíè object "32440000" { @@ -924,6 +956,7 @@ point = 0x1B06; layer_min = 0; layer_max = 0; + label = attr9; } // Ñâåòÿùèå áóè object "32450000" { @@ -932,6 +965,7 @@ point = 0x1B06; layer_min = 0; layer_max = 0; + label = attr9; } // Âîäîìåðíûå ïîñòû object "32460000" { @@ -953,6 +987,7 @@ line = 0x1A; layer_min = 0; layer_max = 2; + label = attr9; } // Ïàðîìû àâòîìîáèëüíûå object "33112000" { @@ -991,6 +1026,18 @@ layer_min = 0; layer_max = 1; label = "áðîä"; + case attr = 2 { + label += " L-"; + label += attr2; + } + case attr = 7 { + label += " H-"; + label += attr7; + } + case attr = 28 { + label += " V-"; + label += attr28; + } } // Ìîðñêèå ïóòè object "33200000" { @@ -998,6 +1045,7 @@ line = 0x1B; layer_min = 0; layer_max = 0; + label = attr9; } // Îñòðîâà object "34000000" { @@ -1020,6 +1068,12 @@ layer_max = 3; label = attr9; city = true; + case intattr38 > 70000 { + point = 0x4; + } + case intattr38 > 1000000 { + point = 0x3; + } case attr43 = "9" { point = 0x4; } @@ -1081,6 +1135,7 @@ polygon = 0x13; layer_min = 0; layer_max = 1; + label = attr9; } // Ïîñåëêè äà÷íîãî òèïà object "43100000" { @@ -1102,6 +1157,7 @@ polygon = 0x03; layer_min = 0; layer_max = 1; + label = attr9; } // Îòäåëüíûå âûäàþùèåñÿ ñòðîåíèÿ object "44100000" { @@ -1148,6 +1204,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // Ïëîùàäè object "45300000" { @@ -1155,6 +1212,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // ×àñòè íàñåëåííîãî ïóíêòà object "45400000" { @@ -1170,6 +1228,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // Ðàéîíû íîâîãî ïðîìûø. ñòð-âà object "45520000" { @@ -1177,6 +1236,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // Âûäàþù. ÷àñòü çäàíèÿ object "46100000" { @@ -1184,6 +1244,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // Êàðüåðû object "51111000" { @@ -1197,6 +1258,7 @@ export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Òîðôîðàçðàáîòêè object "51113000" { @@ -1225,12 +1287,14 @@ export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ðóäíèêè, ïðèèñêè, êîïè object "51122000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Òåððèêîíû object "51123100" { @@ -1308,30 +1372,35 @@ point = 0x6402; layer_min = 0; layer_max = 0; + label = attr9; } // Ì-öû ñ ýë.ïðèâîäîì ñ òðóáàìè object "51153100" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ì-öû ñ ýë.ïðèâîäîì áåç òðóá object "51153200" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ëåñîïèëüíè object "51160000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ïå÷è äëÿ îáæèãà object "51170000" { export = true; layer_min = 0; layer_max = 0; + label = attr9; } // Ñêëàäû object "51210000" { @@ -1420,6 +1489,7 @@ point = 0x6411; layer_min = 0; layer_max = 0; + label = attr9; } // Âåòðÿíûå äâèãàòåëè object "51440000" { @@ -1449,6 +1519,7 @@ point = 0x6411; layer_min = 0; layer_max = 0; + label = attr9; } // Îòñòîéíèêè object "51480000" { @@ -1470,6 +1541,7 @@ polygon = 0x0C; layer_min = 0; layer_max = 0; + label = attr9; } // Ñåëüñêîõîçÿéñòâ. ïðåäïðèÿòèÿ object "52100000" { @@ -1484,12 +1556,14 @@ polygon = 0x0C; layer_min = 0; layer_max = 0; + label = attr9; } // Ïàñåêè object "52400000" { export = false; layer_min = 0; layer_max = 0; + label = attr9; } // Àýðîïîðòû object "53110000" { @@ -1522,6 +1596,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 2; + label = attr9; } // Ïîñàäî÷íûå ïëîùàäêè íà ñóøå object "53140000" { @@ -1548,6 +1623,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 0; + label = attr9; } // Ãèäðîàýðîäðîìû object "53160000" { @@ -1558,6 +1634,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 0; + label = attr9; } // Ïîñàäî÷íûå ïëîùàäêè íà âîäå object "53170000" { @@ -1568,6 +1645,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 0; + label = attr9; } // Ó÷.äîðîã äëÿ âçë.è ïîñàä.ñ-òî object "53180000" { @@ -1578,6 +1656,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 0; + label = attr9; } // Âîåííûå áàçû è îáúåêòû object "53210000" { @@ -1585,6 +1664,7 @@ polygon = 0x04; layer_min = 0; layer_max = 1; + label = attr9; } // Êðåïîñòè, ôîðòû, óêðåïëåíèÿ object "53220000" { @@ -1592,6 +1672,7 @@ polygon = 0x04; layer_min = 0; layer_max = 0; + label = attr9; } // Ìîðñêèå ïîðòû, ãàâàíè object "53230000" { @@ -1616,6 +1697,7 @@ point = 0x6411; layer_min = 0; layer_max = 0; + label = attr9; } // Òåëåâèçèîííûå áàøíè object "53330000" { @@ -1654,6 +1736,7 @@ point = 0x6404; layer_min = 0; layer_max = 0; + label = attr9; } // Öåðêâè object "53420000" { @@ -1670,6 +1753,7 @@ point = 0x6404; layer_min = 0; layer_max = 0; + label = attr9; } // Áóääèéñêèå õðàìû, ïàãîäû object "53440000" { @@ -1678,6 +1762,7 @@ point = 0x6404; layer_min = 0; layer_max = 0; + label = attr9; } // ×àñîâíè object "53450000" { @@ -1732,6 +1817,7 @@ point = 0x6403; layer_min = 0; layer_max = 0; + label = attr9; } // Ñêîòîìîãèëüíèêè object "53550000" { @@ -1740,6 +1826,7 @@ point = 0x6403; layer_min = 0; layer_max = 0; + label = attr9; } // Íàó÷-èññë,ó÷.,ìåä.è äð.ó÷ðåæä. object "53600000" { @@ -1798,6 +1885,7 @@ line = 0x14; layer_min = 0; layer_max = 0; + label = attr9; } // Æåë.äîðîæíûå ñòàíöèîííûå ïóòè object "61121000" { @@ -1828,6 +1916,7 @@ line = 0x14; layer_min = 0; layer_max = 0; + label = attr9; } // Òðàìâàéíûå ëèíèè object "61124000" { @@ -1835,6 +1924,7 @@ line = 0x14; layer_min = 0; layer_max = 0; + label = attr9; } // Àâòîìàãèñòðàëè (àâòîñòðàäû) object "61210000" { @@ -1910,6 +2000,7 @@ line = 0x0A; layer_min = 0; layer_max = 1; + label = attr9; } // Çèìíèå äîðîãè object "61600000" { @@ -1968,6 +2059,7 @@ point = 0x6406; layer_min = 0; layer_max = 2; + label = attr9; } // Òðàíñï. ðàçâÿçêè íà àâ.äîð-àõ object "61970000" { @@ -2014,6 +2106,7 @@ point = 0x2000; layer_min = 0; layer_max = 0; + label = attr9; } // Îñòàíîâî÷íûå è îáãîííûå ïóíêò object "62133000" { @@ -2055,6 +2148,7 @@ point = 0x3001; layer_min = 0; layer_max = 0; + label = attr9; } // Ïóòåâûå ïîñòû object "62142000" { @@ -2130,6 +2224,7 @@ point = 0x6401; layer_min = 0; layer_max = 1; + label = attr9; } // Ìîñòû ïîäúåìíûå è ðàçâîäíûå object "62314000" { @@ -2138,6 +2233,7 @@ point = 0x6401; layer_min = 0; layer_max = 1; + label = attr9; } // Ìîñòû ïðî÷èå object "62315000" { @@ -2146,6 +2242,7 @@ point = 0x6401; layer_min = 0; layer_max = 1; + label = attr9; } // Ìîñòû ÷åðåç íåçíà÷èò.ïðåï-âèÿ object "62318000" { @@ -2174,6 +2271,7 @@ point = 0x6413; layer_min = 0; layer_max = 0; + label = attr9; } // Ýñòàêàäû object "62340000" { @@ -2288,6 +2386,7 @@ polygon = 0x50; layer_min = 0; layer_max = 0; + label = attr9; } // Ãîðåëûå è ñóõîñòîéíûå ëåñà object "71112200" { @@ -2324,6 +2423,7 @@ polygon = 0x4F; layer_min = 0; layer_max = 0; + label = attr9; } // Ëåñíûå ïèòîìíèêè, ìîë.ïîñàäêè object "71121000" { @@ -2338,6 +2438,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // Ôðóêòîâûå è öèòðóñîâûå ñàäû object "71123000" { @@ -2371,6 +2472,7 @@ polygon = 0x4F; layer_min = 0; layer_max = 0; + label = attr9; } // Îáû÷íûå êóñòàðíèêè object "71211200" { @@ -2407,6 +2509,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // Âèíîãðàäíèêè object "71222000" { @@ -2415,6 +2518,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // ßãîäíûå ñàäû object "71223000" { @@ -2423,6 +2527,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // Êêñòàðíè÷. ðàñò-òü âäîëü äîðî object "71224000" { @@ -2431,6 +2536,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // Êàìûø.è òðîñòíèê.òðàâÿí.ðàñò. object "71311000" { @@ -2497,6 +2603,7 @@ polygon = 0x4E; layer_min = 0; layer_max = 0; + label = attr9; } // Ïîëóêóñòàðíèêè object "71410000" { @@ -2527,6 +2634,7 @@ polygon = 0x52; layer_min = 0; layer_max = 0; + label = attr9; } // Ïðîñåêè object "71610000" { @@ -2542,6 +2650,7 @@ polygon = 0x50; layer_min = 0; layer_max = 0; + label = attr9; } // Õàðàêòåðèñòèêà ðàñòèòåëüíîñòè object "71630000" { @@ -2630,6 +2739,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr9; } // Ïåñêè ëóíêîâûå è ÿ÷åèñòûå object "72254000" { @@ -2637,6 +2747,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr9; } // Ïåñêè ðîâíûå object "72255000" { Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- PolishFormat.cpp 16 May 2004 17:56:58 -0000 1.33 +++ PolishFormat.cpp 17 May 2004 08:46:36 -0000 1.34 @@ -241,12 +241,6 @@ } break; //========================================================== - case 61330000: // Ïîëåâûå è ëåñíûå äîðîãè - case 61410000: // Êàðàâàí. ïóòè è âüþ÷íûå òðîïû - case 61420000: // Ïåøåõîäíûå òðîïû - case 61600000: // Çèìíèå äîðîãè - case 71610000: // Ïðîñåêè - case 31431000: // Êàíàëû case 11200000: // Ïóíêòû ÃÃÑ case 11300000: // Òî÷êè ñúåìî÷íîé ñåòè case 11400000: // Ïóíêòû íåâåëèðíîé ñåòè @@ -263,58 +257,12 @@ atr_num = (int)(atr_num * 3.28084); sprintf(rus_name, "%d\0", atr_num); break; - case 41100000: // Ãîðîäà - // 43 Ïîëèòèêî-àäìèíèñòðàòèâíîå çíà÷åíèå - // 38 Êîë-âî æèòèëåé - //RGN_point = 0x20; - //img_Layer_max = 1; - - //Type_point = 0x05; - if (s_atoi(obj[NumObj].atr_cod[38]) > 70000) { - //img_Layer_max = 2; - Type_point = 0x04; - } - if (s_atoi (obj[NumObj].atr_cod[38]) > 1000000) { - //img_Layer_max = 2; - Type_point = 0x03; - } - //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') - // obj[NumObj].Cod[0] = 'P'; - - // 3 Ñîñòîÿíèå (5 - æèëîé 6 - íåæèëîé) - // 6 Ìàõ âûñîòà - // ST Ãîñ. ïðèíàäëåæíîñòü. - // AR Ðåãèîíàë. ïðèíàäëåæíîñòü. - // RJ Ðàéîííàÿ ïðèíàäëåæíîñòü. - // printf ("%i ", atoi (obj[NumObj].atr_cod[38])); - //printf ("%s\n", obj[NumObj].atr_cod[9]); - //printf ("%s\n", obj[NumObj].atr_cod[43]); - break; case 44200000: // Îòäåëüíûå íåâûäàþù. ñòðîåíèÿ // 9 Íàçâàíèå // 47 Ôóíêöèîíàëüíîå íàçíà÷åíèå if (obj[NumObj].Cod[0] == 'L') rus_name[0] = 0; break; - case 45100000: // Êâàðòàëû â íàñåëåííûõ ïóíêòàõ - case 45200000: // Óëèöû - case 71111110: // Ëåñà ãóñòûå âûñîêèå (îáû÷íûå) - case 22211000: // Îâðàãè - case 22212000: // Ïðîìîèíû - case 22630000: // Îáðûâû - case 31432000: // Êàíàâû - case 32110000: // Ïëîòèíû - case 22250000: // ßìû - case 22310000: // Ñêàëû-îñòàíöû - case 22410000: // Ñêàëû è ñêàëèñòûå îáðûâû - case 22521000: // Êóðãàíû - case 22522000: // Áóãðû - case 22611000: // Ñêîïëåíèÿ êàìíåé - case 22612000: // Îòäåëüíî ëåæàùèå êàìíè - case 22620000: // Áóãðû - case 22640000: // Âõîäû â ïåùåðû è ãðîòû - case 31521000: // Íàïðàâëåíèå îñíîâíîãî òå÷åíèÿ - break; case 31531000: // Õàðàêòåðèñòèêè ðåê è êàíàëîâ // 34 Õàððàêòåð ãðóíòà if (obj[NumObj].atr_cod[34]) { @@ -322,11 +270,6 @@ strcat(rus_name, getAttr34Str((BYTE*)obj[NumObj].atr_cod[34])); } break; - case 31540000: // Óêàçàò.íà÷.ðåãóë.ñóäîõîäñòâà - case 32121000: // Âîðîòà øëþçîâ - case 32140000: // Íàáåðåæíûå - case 32410000: // Ìàÿêè - break; case 33112000: // Ïàðîìû àâòîìîáèëüíûå if (obj[NumObj].Cod[0] != 'D') obj[NumObj].Cod[0] = 'P'; @@ -336,21 +279,6 @@ if (obj[NumObj].Cod[0] != 'D') obj[NumObj].Cod[0] = 'P'; //img_Layer_max = 1; - // 2 Äëèíà - if (obj[NumObj].atr_cod[2] != 0) { - strcat(rus_name, " L-"); - strcat(rus_name, obj[NumObj].atr_cod[2]); - } - // 7 Ãëóáèíà - if (obj[NumObj].atr_cod[7] != 0) { - strcat(rus_name, " H-"); - strcat(rus_name, obj[NumObj].atr_cod[7]); - } - // 28 Ñêîðîñòü òå÷åíèÿ - if (obj[NumObj].atr_cod[28] != 0) { - strcat(rus_name, " V-"); - strcat(rus_name, obj[NumObj].atr_cod[28]); - } // 34 Õàððàêòåð ãðóíòà if (obj[NumObj].atr_cod[34] != 0) { strcat(rus_name, " "); @@ -358,25 +286,6 @@ } //printf ("%s\n", rus_name); break; - case 31140000: // Ïëîùàäè ðàçëèâîâ (çîíû çàòîï. - case 31211000: // Îòìåëè - case 31700000: // Áåðåãîâàÿ ëèíèÿ - case 31333000: // Êàìíè - case 31612000: // Èñòî÷íèêè íåîáîðóäîâàííûå - case 31631000: //Êîëîäöû àðòåçèàíñêèå - case 31640000: // Àðòåçèàíñêèå ñêâàæèíû - case 32120000: // Øëþçû - case 32130000: // Äàìáû è èñêóññòâåííûå âàëû - case 32150000: // Áåðåãà ñ óêðåïëåííûìè îòêîñàì - case 32310000: // Âîäîïðîâîäû - case 32460000: // Âîäîìåðíûå ïîñòû - case 33113000: // Ïàðîìû àâòîãóæåâûå - case 33120000: // Ïåðåâîçû - case 31241000: // Áåðåãà îáðûâ. è ñêàë. ñ ïëÿæå - case 31242000: // Áåðåãà îáð. è ñêàë. áåç ïëÿæà - case 31331000: // Ðèôû - // ATR 35 - break; case 31335100: // Âîäîïàäû if (obj[NumObj].Cod[0] != 'D') obj[NumObj].Cod[0] = 'P'; @@ -387,89 +296,15 @@ obj[NumObj].Cod[0] = 'P'; //img_Layer_max = 1; break; - //========================================================== - case 51111000: // Êàðüåðû - case 51330000: // Ëèíèè ñâÿçè - case 51113000: // Òîðôîðàçðàáîòêè - case 51131000: // Ïðîì. ïðåäïðèÿòèÿ ñ òðóáàìè - case 51132000: // Ïðîì. ïðåäïðèÿòèÿ áåç òðóá - case 51123200: // Îòâàëû - case 51121100: // Øàõòû - case 51121200: // Øòîëüíè - case 51123100: // Òåððèêîíû - case 51124100: // Ñêâàæèíû - case 51140000: // Ýëåêòðîñòàíöèè - case 51151000: // Ìåëüíèöû âîäÿíûå - case 51210000: // Ñêëàäû - case 51220000: // Çàïð. ñòàíöèè è áåíçîêîëîíêè - case 53230000: // Ìîðñêèå ïîðòû, ãàâàíè - case 52100000: // Ñåëüñêîõîçÿéñòâ. ïðåäïðèÿòèÿ - case 51230000: // Îòä.öèñòåðíû,áàêè,ãàçãîëüäåðû - case 51410000: // Êàïèòàëüíûå ñîîð. áàøåí. òèïà - case 51420000: // Çàâîäñêèå è ôàáðè÷íûå òðóáû - case 51450000: // Ñòàíöèè îáñëóæ. òðóáîïðîâîäîâ - case 51460000: // Ýëåêòðè÷åñêèå ïîäñòàíöèè - case 53310000: // Ðàäèîñòàíöèè - case 53330000: // Òåëåâèçèîííûå áàøíè - case 53340000: //Ìà÷òû(ðàäèî,òåë.,ðàäèîðåëåéí.) - case 53350000: // Ìåòåîðîëîãè÷åñêèå ñòàíöèè - case 53420000: // Öåðêâè - case 53450000: // ×àñîâíè - case 53430000: // Ìå÷åòè - case 53700000: // Ñïîðòèâíûå ñîîðóæåíèÿ - case 61121000: // Æåë.äîðîæíûå ñòàíöèîííûå ïóòè - case 61122200: // Ïîäúåçäíûå ïóòè - case 62340000: // Ýñòàêàäû - case 62350000: // Íàñûïè - case 62360000: // Âûåìêè - case 62370000: // Òðóáû - case 61122100: // Òóïèêè - case 61940000: // Òðóäíîïðîåçæèå ó÷àñòêè äîðîã - case 62142000: // Ïóòåâûå ïîñòû - case 62311000: // Ìîñòû íà îáù. ïðîëåòíîì îñíîâ. - case 62312000: //Ìîñòû íà ðàçîáùåí.ïðîëåò.îñ-ÿ - case 62318000: // Ìîñòû ÷åðåç íåçíà÷èò.ïðåï-âèÿ - case 63200000: // Óê-òåëü äëÿ îáîçíà÷.ðàññòîÿíèÿ - case 61970000: //Òðàíñï. ðàçâÿçêè íà àâ.äîð-àõ - case 63100000: - case 71111210: // Ëåñà ðåäêèå âûñîêèå (îáû÷íûå) - case 71112200: // Ãîðåëûå è ñóõîñòîéíûå ëåñà - case 71112300: // Âûðóáëåíûå ëåñà - case 71111120: // Ëåñà ãóñòûå íèçêîðîñëûå - case 71111220: // Ëåñà ãóñòûå íèçêîðîñëûå - case 71123000: // Ôðóêòîâûå è öèòðóñîâûå ñàäû - case 71113000: // Ïîðîñëü ëåñà - case 71121000: // Ëåñíûå ïèòîìíèêè, ìîë.ïîñàäêè - case 71211200: // Îáû÷íûå êóñòàðíèêè - case 71131000: // Äðåâåñ.ðàñ-òü âäîëü äîðîã,óëè - case 71132000: // Îòäåëüíûå äåðåâüÿ - case 71314000: // Ëóãîâàÿ òðàâÿí.ðàñò-òü åñò.ïð - case 71311000: // Êàìûø.è òðîñòíèê.òðàâÿí.ðàñò. - case 71510000: //Ìõè - case 71630000: // Õàðàêòåðèñòèêà ðàñòèòåëüíîñòè - case 72110000: // Êàìåíèñòûå ïîâåðõíîñòè - case 72120000: // Êàìåíèñò.ðîññûïè è ùåá.ïîâ-òè - case 72252000: // Ïåñêè ãðÿäîâûå è äþííûå - case 72255000: // Ïåñêè ðîâíûå - case 81110000: // Ëèíèÿ ãðàíèöû - break; case 81111000: // Ðåãèîí //img_Layer_max = 2; //Type_line = 0x1c; if (obj[NumObj].Cod[0] != 'D') obj[NumObj].Cod[0] = 'L'; break; - case 82100000: // Äðåâíèå èñòîðè÷åñêèå ñòåíû - case 82300000: // Ëåãêèå îãðàæäåíèÿ - case 91700000: // Òåêñò â ìàðêåðå - // Íàçâàíèÿ äîðîã - break; - case 91500000: // Òåêñò - break; default: - if (rus_name[0] == 0) - DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); + break; } // Ðàçáîð òèïîâ îáúåêòîâ ñ òîïîïëàíîâ - PLAN.DBF |
From: Denis P. <dy...@us...> - 2004-05-16 17:57:08
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19939 Modified Files: PolishFormat.cpp eval.cpp evalImpl.h parser.cpp topo.conf Log Message: - add += for string and int - adjust topo.conf Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- parser.cpp 16 May 2004 17:40:41 -0000 1.7 +++ parser.cpp 16 May 2004 17:56:58 -0000 1.8 @@ -249,6 +249,8 @@ BoolLVar *bVar = parseBoolLVar(varName); if (bVar != NULL) { // boolean vars + if (t.nextToken() != '=') + throw ParserException("Expected '='"); BoolAssign *a = new BoolAssign(); a->lvalue = bVar; a->rvalue = parseBoolExpr(t); @@ -262,7 +264,20 @@ IntLVar *iVar = parseIntLVar(varName); if (iVar != NULL) { - IntAssign *a = new IntAssign(); + IntAssign *a; + switch (t.nextToken()) { + case '=': + a = new IntAssign(); + break; + case '+': + if (t.nextToken() != '=') + throw ParserException("Expected '+='"); + a = new IntPlusAssign(); + break; + default: + throw ParserException("Expected '=' or '+='"); + } + a->rvalue = parseIntExpr(t); a->lvalue = iVar; if (a->rvalue == NULL) @@ -277,7 +292,20 @@ if (sVar == NULL) throw ParserException(("Unknown variable: " + varName).c_str()); - StringAssign *a = new StringAssign(); + StringAssign *a; + switch (t.nextToken()) { + case '=': + a = new StringAssign(); + break; + case '+': + if (t.nextToken() != '=') + throw ParserException("Expected '+='"); + a = new StringPlusAssign(); + break; + default: + throw ParserException("Expected '=' or '+='"); + } + a->rvalue = parseStringExpr(t); a->lvalue = sVar; if (a->rvalue == NULL) @@ -303,9 +331,6 @@ b->addCase(c); } else { varName = t.sval; - - if (t.nextToken() != '=') - throw ParserException("Expected '='"); parseAssign(b, varName, t); if (t.nextToken() != ';') throw ParserException("Expected ';'"); Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/eval.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- eval.cpp 16 May 2004 17:22:21 -0000 1.4 +++ eval.cpp 16 May 2004 17:56:58 -0000 1.5 @@ -73,10 +73,18 @@ lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); } +void IntPlusAssign::exec(const h_object *obj, ObjectProp &o, int numArray) { + lvalue->setValue(o, lvalue->getValue(obj, o, numArray) + rvalue->getValue(obj, o, numArray)); +} + void StringAssign::exec(const h_object *obj, ObjectProp &o, int) { lvalue->setValue(o, rvalue->getValue(obj, o)); } +void StringPlusAssign::exec(const h_object *obj, ObjectProp &o, int) { + lvalue->setValue(o, lvalue->getValue(obj, o) + rvalue->getValue(obj, o)); +} + void BoolAssign::exec(const h_object *obj, ObjectProp &o, int numArray) { lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- evalImpl.h 16 May 2004 17:40:41 -0000 1.6 +++ evalImpl.h 16 May 2004 17:56:58 -0000 1.7 @@ -167,6 +167,11 @@ virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; +class StringPlusAssign : public StringAssign { +public: + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); +}; + class IntAssign : public Assign { public: IntLVar *lvalue; @@ -175,6 +180,11 @@ virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; +class IntPlusAssign : public IntAssign { +public: + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); +}; + class BoolExpr { public: virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- topo.conf 16 May 2004 17:40:41 -0000 1.6 +++ topo.conf 16 May 2004 17:56:58 -0000 1.7 @@ -592,6 +592,9 @@ layer_min = 0; layer_max = 1; label = attr9; + case attr = 9 { + layer_max += 1; + } } // Êàíàâû object "31432000" { @@ -635,6 +638,14 @@ point = 0x6500; layer_min = 0; layer_max = 0; + case attr = 7 { + label += " H-"; + label += attr7; + } + case attr = 11 { + label += " W-"; + label += attr11; + } } // Õàðàêòåðèñòèêè ñóõèõ êàíàâ object "31532000" { @@ -1360,6 +1371,12 @@ line = 0x29; layer_min = 0; layer_max = 2; + case attr = 41 { + label = attr41; + case label != "" { + label += " êÂ"; + } + } } // Ëèíèè ñâÿçè object "51330000" { Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- PolishFormat.cpp 16 May 2004 17:40:41 -0000 1.32 +++ PolishFormat.cpp 16 May 2004 17:56:58 -0000 1.33 @@ -246,16 +246,7 @@ case 61420000: // Ïåøåõîäíûå òðîïû case 61600000: // Çèìíèå äîðîãè case 71610000: // Ïðîñåêè - break; case 31431000: // Êàíàëû - //Type_poly = 0x46; - //Type_line = 0x1f; - //img_Layer_max = 0; - if (obj[NumObj].atr_cod[9] != 0) - img_Layer_max++; // Èìååò èìÿ - break; - //========================================================== - case 11200000: // Ïóíêòû ÃÃÑ case 11300000: // Òî÷êè ñúåìî÷íîé ñåòè case 11400000: // Ïóíêòû íåâåëèðíîé ñåòè @@ -325,16 +316,6 @@ case 31521000: // Íàïðàâëåíèå îñíîâíîãî òå÷åíèÿ break; case 31531000: // Õàðàêòåðèñòèêè ðåê è êàíàëîâ - // 7 Ãëóáèíà - if (obj[NumObj].atr_cod[7]) { - strcat(rus_name, " H-"); - strcat(rus_name, obj[NumObj].atr_cod[7]); - } - // 11 Øèðèíà - if (obj[NumObj].atr_cod[11]) { - strcat(rus_name, " W-"); - strcat(rus_name, obj[NumObj].atr_cod[11]); - } // 34 Õàððàêòåð ãðóíòà if (obj[NumObj].atr_cod[34]) { strcat(rus_name, " "); @@ -428,20 +409,6 @@ case 51420000: // Çàâîäñêèå è ôàáðè÷íûå òðóáû case 51450000: // Ñòàíöèè îáñëóæ. òðóáîïðîâîäîâ case 51460000: // Ýëåêòðè÷åñêèå ïîäñòàíöèè - break; - case 51320000: // Ëèíèè ýëåêòðîïåðåäà÷è - //img_Layer_max = 1; - // L - // 01 - // 03 - // 41 Íàïðÿæåíèå - // 48 - // 49 - DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[41]); - if (strlen(rus_name) > 0 ) - strcat(rus_name, " êÂ"); - break; - case 53310000: // Ðàäèîñòàíöèè case 53330000: // Òåëåâèçèîííûå áàøíè case 53340000: //Ìà÷òû(ðàäèî,òåë.,ðàäèîðåëåéí.) |
From: Denis P. <dy...@us...> - 2004-05-16 17:40:53
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15970 Modified Files: PolishFormat.cpp eval.h evalImpl.h parser.cpp topo.conf Log Message: - implement city var - adjust topo.conf Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- parser.cpp 16 May 2004 17:22:21 -0000 1.6 +++ parser.cpp 16 May 2004 17:40:41 -0000 1.7 @@ -52,6 +52,8 @@ return new ExportVar(); if (varName == "index") return new IndexVar(); + if (varName == "city") + return new CityVar(); return NULL; } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- evalImpl.h 16 May 2004 17:22:21 -0000 1.5 +++ evalImpl.h 16 May 2004 17:40:41 -0000 1.6 @@ -217,6 +217,16 @@ } }; +class CityVar : public BoolLVar { + virtual bool getValue(const h_object *, const ObjectProp &o, int) { + return o.city; + } + + virtual void setValue(ObjectProp &o, bool value) { + o.city = value; + } +}; + class NotExpr : public BoolExpr { public: NotExpr(BoolExpr *_expr) : expr(_expr) { Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- topo.conf 16 May 2004 17:22:21 -0000 1.5 +++ topo.conf 16 May 2004 17:40:41 -0000 1.6 @@ -1008,6 +1008,7 @@ layer_min = 0; layer_max = 3; label = attr9; + city = true; case attr43 = "9" { point = 0x4; } @@ -1025,6 +1026,7 @@ layer_min = 0; layer_max = 3; label = attr9; + city = true; case attr43 = "9" { point = 0x4; } @@ -1039,6 +1041,7 @@ layer_min = 0; layer_max = 2; label = attr9; + city = true; case attr43 = "9" { point = 0x4; } Index: eval.h =================================================================== RCS file: /cvsroot/cmap/cmap/eval.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- eval.h 16 May 2004 17:22:21 -0000 1.4 +++ eval.h 16 May 2004 17:40:41 -0000 1.5 @@ -14,6 +14,7 @@ bool index; bool doExport; + bool city; int type; Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- PolishFormat.cpp 16 May 2004 17:22:21 -0000 1.31 +++ PolishFormat.cpp 16 May 2004 17:40:41 -0000 1.32 @@ -242,23 +242,11 @@ break; //========================================================== case 61330000: // Ïîëåâûå è ëåñíûå äîðîãè - //Type_line = 0x06; - //img_Layer_max = 0; - break; case 61410000: // Êàðàâàí. ïóòè è âüþ÷íûå òðîïû case 61420000: // Ïåøåõîäíûå òðîïû case 61600000: // Çèìíèå äîðîãè - //Type_line = 0x16; - //img_Layer_max = 0; - //DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); - break; case 71610000: // Ïðîñåêè - //Type_line = 0x16; - //img_Layer_max = 0; - //DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); - // 2 Ñïîñîá äâèæåíèÿ (1 ãóñ. 2 àâòî) break; - //========================================================== case 31431000: // Êàíàëû //Type_poly = 0x46; //Type_line = 0x1f; @@ -301,8 +289,6 @@ } //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') // obj[NumObj].Cod[0] = 'P'; - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'C'; // 3 Ñîñòîÿíèå (5 - æèëîé 6 - íåæèëîé) // 6 Ìàõ âûñîòà @@ -313,28 +299,6 @@ //printf ("%s\n", obj[NumObj].atr_cod[9]); //printf ("%s\n", obj[NumObj].atr_cod[43]); break; - case 41200000: // Ïîñåëêè ãîðîäñêîãî òèïà (ÏÃÒ) - // A, P - //RGN_point = 0x20; - //img_Layer_max = 1; - //Type_point = 0x06; - //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') - // obj[NumObj].Cod[0] = 'P'; - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'C'; - - break; - case 42100000: // Ïîñåëêè ñåëüñêîãî òèïà - // A, P - //RGN_point = 0x20; - //img_Layer_max = 1; - //Type_point = 0x07; - //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') - // obj[NumObj].Cod[0] = 'P'; - if (obj[NumObj].Cod[0] != 'D') - obj[NumObj].Cod[0] = 'C'; - - break; case 44200000: // Îòäåëüíûå íåâûäàþù. ñòðîåíèÿ // 9 Íàçâàíèå // 47 Ôóíêöèîíàëüíîå íàçíà÷åíèå @@ -537,7 +501,8 @@ break; default: - DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); + if (rus_name[0] == 0) + DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); } // Ðàçáîð òèïîâ îáúåêòîâ ñ òîïîïëàíîâ - PLAN.DBF @@ -722,6 +687,9 @@ } // end switch(TYPE) } // êîíåö îáðàáîòêè òèïîâ îáúåêòîâ ïî àòðèáóòó 47 + if (o.city) + obj[NumObj].Cod[0] = 'C'; + type_obj = obj[NumObj].Cod[0]; // Îòáðàñûâàíèå îáúåêòîâ, äëÿ êîòîðûõ íå çàïîëíåíû ïîëÿ TYPE_X â DBF |
From: Denis P. <dy...@us...> - 2004-05-16 17:22:31
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11673 Modified Files: PolishFormat.cpp eval.cpp eval.h evalImpl.h parser.cpp topo.conf Log Message: - implement attr set var - implement label string var - everywhere in assignments use expr as rvalue instead of constant - try to move everything supported to config Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- parser.cpp 16 May 2004 13:48:57 -0000 1.5 +++ parser.cpp 16 May 2004 17:22:21 -0000 1.6 @@ -33,7 +33,7 @@ printf("eol\n"); break; case TT_NUMBER: - printf("num: %d\n", t.nval); + printf("%ld: num: %d\n", t.lineno(), t.nval); break; case TT_WORD: printf("word: %s\n", t.sval.c_str()); @@ -42,7 +42,7 @@ printf("string: %s\n", t.sval.c_str()); break; default: - printf("char: %c\n", (unsigned char)t.ttype); + printf("%ld: char: %c\n", t.lineno(), (unsigned char)t.ttype); break; } } @@ -85,35 +85,10 @@ return NULL; } -void setValue(Block *b, const std::string &varName, Tokenizer &t) { - BoolLVar *bVar = parseBoolLVar(varName); - - if (bVar != NULL) { // boolean vars - if (t.nextToken() != TT_WORD) - throw ParserException("Expected 'true' or 'false'"); - - BoolAssign *a = new BoolAssign(); - a->lvalue = bVar; - a->rvalue = parseBoolConst(t.sval); - if (a->rvalue == NULL) - throw ParserException("Expected 'true' or 'false'"); - - b->addAssign(a); - } else { - if (t.nextToken() != TT_NUMBER) - throw ParserException("Expected number"); - IntAssign *a = new IntAssign(); - a->rvalue = new IntConst(t.nval); - - IntLVar *iVar = parseIntLVar(varName); - - if (iVar == NULL) - throw ParserException("Invalid variable name"); - - a->lvalue = iVar; - - b->addAssign(a); - } +StringLVar *parseStringLVar(const std::string &varName) { + if (varName == "label") + return new LabelLVar(); + return NULL; } BoolExpr *parseBoolVar(const std::string &varName) { @@ -140,8 +115,8 @@ return parseIntRVar(varName); } -StringExpr *parseStringVar(const std::string &varName) { - if (strncmp(varName.c_str(), "attr", 4) == 0) { // attrNUM var +StringExpr *parseStringRVar(const std::string &varName) { + if ((varName.length() > 4) && (strncmp(varName.c_str(), "attr", 4) == 0)) { // attrNUM var char *err; long n = strtol(varName.c_str() + 4, &err, 10); if ((*err != 0) || (n > 110)) @@ -151,6 +126,15 @@ return NULL; } +StringExpr *parseStringVar(const std::string &varName) { + StringExpr *se = parseStringLVar(varName); + if (se != NULL) + return se; + if ((se = parseStringRVar(varName)) != NULL) + return se; + return NULL; +} + IntExpr *parseIntExpr(Tokenizer &t) { switch (t.nextToken()) { case TT_NUMBER: @@ -185,6 +169,12 @@ } } +SetVar *parseSetVar(const std::string &varName) { + if (varName == "attr") + return new AttrSetVar(); + return NULL; +} + BoolExpr *parseBoolExpr(Tokenizer &t) { if (t.nextToken() == '!') return new NotExpr(parseBoolExpr(t)); @@ -202,6 +192,7 @@ IntExpr *ie; StringExpr *se; + SetVar *sv; if ((ie = parseIntVar(t.sval)) != NULL) { switch (t.nextToken()) { @@ -237,11 +228,62 @@ default: throw ParserException("Expected = or !="); } -// } else if ((SetExpr *l = parseSetVar(t.sval) != NULL) { + } else if ((sv = parseSetVar(t.sval)) != NULL) { + switch (t.nextToken()) { + case '=': + return new InExpr(sv, parseIntExpr(t)); + case '!': + if (t.nextToken() != '=') + throw ParserException("Expect !="); + return new NotInExpr(sv, parseIntExpr(t)); + default: + throw ParserException("Expected = or !="); + } } else throw ParserException(("Unknown variable: " + t.sval).c_str()); } +void parseAssign(Block *b, const std::string &varName, Tokenizer &t) { + BoolLVar *bVar = parseBoolLVar(varName); + + if (bVar != NULL) { // boolean vars + BoolAssign *a = new BoolAssign(); + a->lvalue = bVar; + a->rvalue = parseBoolExpr(t); + if (a->rvalue == NULL) + throw ParserException("Boolean expression expected"); + + b->addAssign(a); + return; + } + + IntLVar *iVar = parseIntLVar(varName); + + if (iVar != NULL) { + IntAssign *a = new IntAssign(); + a->rvalue = parseIntExpr(t); + a->lvalue = iVar; + if (a->rvalue == NULL) + throw ParserException("Integer expression expected"); + + b->addAssign(a); + return; + } + + StringLVar *sVar = parseStringLVar(varName); + + if (sVar == NULL) + throw ParserException(("Unknown variable: " + varName).c_str()); + + StringAssign *a = new StringAssign(); + a->rvalue = parseStringExpr(t); + a->lvalue = sVar; + if (a->rvalue == NULL) + throw ParserException("String expression expected"); + + b->addAssign(a); +} + void parseBlock(Tokenizer &t, Block *b) { if (t.nextToken() != '{') throw ParserException("Expected '{'"); @@ -262,14 +304,14 @@ if (t.nextToken() != '=') throw ParserException("Expected '='"); - setValue(b, varName, t); + parseAssign(b, varName, t); if (t.nextToken() != ';') throw ParserException("Expected ';'"); } } } -bool readObject(Tokenizer &t) { +bool parseObject(Tokenizer &t) { switch (t.nextToken()) { case TT_EOF: return false; @@ -319,7 +361,7 @@ t.slashSlashComments(true); try { - while (readObject(t)) + while (parseObject(t)) ; } catch (ParserException &x) { printf("%s\n", x.what()); Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- topo.conf 16 May 2004 13:48:57 -0000 1.4 +++ topo.conf 16 May 2004 17:22:21 -0000 1.5 @@ -360,6 +360,7 @@ polygon = 0x28; layer_min = 0; layer_max = 3; + label = attr9; } // Îçåðà object "31120000" { @@ -370,6 +371,7 @@ polygon = 0x3C; layer_min = 0; layer_max = 2; + label = attr9; case length < 50000 { layer_max = 0; } @@ -386,6 +388,7 @@ polygon = 0x3D; layer_min = 0; layer_max = 2; + label = attr9; } // Ïðóäû object "31132000" { @@ -395,6 +398,7 @@ polygon = 0x3E; layer_min = 0; layer_max = 0; + label = attr9; } // Áàññåéíû object "31133000" { @@ -404,6 +408,7 @@ polygon = 0x3F; layer_min = 0; layer_max = 0; + label = attr9; } // Äîæä.ÿìû è ñîîð.äëÿ ñáîðà âîä object "31134000" { @@ -444,6 +449,7 @@ export = false; layer_min = 0; layer_max = 0; + label = attr29; // 29 Âåëè÷èíà ïðèëèâà } // Áåðåãà îáðûâ. è ñêàë. ñ ïëÿæå object "31241000" { @@ -505,6 +511,7 @@ polygon = 0x53; layer_min = 0; layer_max = 0; + label = attr9; } // Êàìíè object "31333000" { @@ -521,6 +528,7 @@ point = 0x6607; layer_min = 0; layer_max = 0; + label = attr9; } // Âîäîïàäû object "31335100" { @@ -529,6 +537,10 @@ point = 0x6508; layer_min = 0; layer_max = 1; + label = attr9; + case attr != 9 { + label = "âäï"; + } } // Ïîðîãè object "31335200" { @@ -538,6 +550,10 @@ line = 0x1B; layer_min = 0; layer_max = 0; + label = attr9; + case attr != 9 { + label = "ïîðîã"; + } } // Ðåêè object "31410000" { @@ -546,6 +562,7 @@ polygon = 0x46; layer_min = 0; layer_max = 1; + label = attr9; case attr35 = "5" { line = 0x26; polygon = 0x4C; @@ -560,6 +577,7 @@ polygon = 0x46; layer_min = 0; layer_max = 0; + label = attr9; case attr35 = "5" { line = 0x26; polygon = 0x4C; @@ -573,6 +591,7 @@ polygon = 0x46; layer_min = 0; layer_max = 1; + label = attr9; } // Êàíàâû object "31432000" { @@ -809,6 +828,7 @@ point = 0x4300; layer_min = 0; layer_max = 1; + label = attr9; } // Ïðèñòàíè áåç îáîðóä. ïðè÷àëîâ object "32250000" { @@ -817,6 +837,7 @@ point = 0x4300; layer_min = 0; layer_max = 0; + label = attr9; } // Ñïóñêè è ëåñòíèöû íà íàáåðåæí object "32260000" { @@ -930,6 +951,7 @@ line = 0x1A; layer_min = 0; layer_max = 2; + label = "ïàðîì"; } // Ïàðîìû àâòîãóæåâûå object "33113000" { @@ -957,6 +979,7 @@ line = 0x16; layer_min = 0; layer_max = 1; + label = "áðîä"; } // Ìîðñêèå ïóòè object "33200000" { @@ -973,6 +996,7 @@ polygon = 0x53; layer_min = 0; layer_max = 3; + label = attr9; } // Ãîðîäà object "41100000" { @@ -983,6 +1007,7 @@ polygon = 0x01; layer_min = 0; layer_max = 3; + label = attr9; case attr43 = "9" { point = 0x4; } @@ -999,6 +1024,7 @@ polygon = 0x02; layer_min = 0; layer_max = 3; + label = attr9; case attr43 = "9" { point = 0x4; } @@ -1012,6 +1038,7 @@ polygon = 0x03; layer_min = 0; layer_max = 2; + label = attr9; case attr43 = "9" { point = 0x4; } @@ -1029,6 +1056,7 @@ polygon = 0x13; layer_min = 0; layer_max = 2; + label = attr9; } // Ïîñòîÿííûå ñòîÿíêè þðò è ÷óìî object "42300000" { @@ -1049,6 +1077,7 @@ polygon = 0x03; layer_min = 0; layer_max = 1; + label = attr9; } // Ïîñåëêè, íå îòíåñ. ê êàò. ïãò object "43200000" { @@ -1069,6 +1098,10 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; + case attr != 49 { + export = false; + } } // Îòäåëüíûå íåâûäàþù. ñòðîåíèÿ object "44200000" { @@ -1079,6 +1112,10 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; + case attr != 49 { + export = false; + } } // Êâàðòàëû â íàñåëåííûõ ïóíêòàõ object "45100000" { @@ -1111,6 +1148,7 @@ polygon = 0x13; layer_min = 0; layer_max = 0; + label = attr9; } // Ðàéîíû íîâîãî æèëèùíîãî ñòð-â object "45510000" { @@ -1311,6 +1349,7 @@ line = 0x28; layer_min = 0; layer_max = 0; + label = attr9; } // Ëèíèè ýëåêòðîïåðåäà÷è object "51320000" { @@ -1441,6 +1480,7 @@ polygon = 0x07; layer_min = 0; layer_max = 3; + label = attr9; } // Àýðîäðîìû object "53120000" { @@ -1451,6 +1491,7 @@ polygon = 0x07; layer_min = 0; layer_max = 3; + label = attr9; } // Âçëåòíî-ïîñàäî÷íûå ïîëîñû object "53130000" { @@ -1470,6 +1511,7 @@ polygon = 0x0E; layer_min = 0; layer_max = 1; + label = attr9; } // Ñïåöèàëüíûå äîðîæêè object "53151000" { @@ -1633,6 +1675,7 @@ polygon = 0x1A; layer_min = 0; layer_max = 0; + label = attr9; } // Êëàäáèùà áåç ãóñòîé äð.ðàñòèò object "53512000" { @@ -1642,6 +1685,7 @@ polygon = 0x1A; layer_min = 0; layer_max = 0; + label = attr9; } // Âûäàþùèåñÿ ïàìÿòíèêè object "53520000" { @@ -1650,6 +1694,7 @@ point = 0x2C04; layer_min = 0; layer_max = 2; + label = attr9; } // Ïðî÷.ïàìÿòí.,ìîíóìåíòû,ìîãèëû object "53530000" { @@ -1658,6 +1703,7 @@ point = 0x2C04; layer_min = 0; layer_max = 2; + label = attr9; } // Ìàçàðû, ñóáóðãàíû, îáî object "53540000" { @@ -1683,6 +1729,7 @@ polygon = 0x0A; layer_min = 0; layer_max = 0; + label = attr47; } // Ñïîðòèâíûå ñîîðóæåíèÿ object "53700000" { @@ -1703,9 +1750,14 @@ line = 0x14; layer_min = 0; layer_max = 3; + label = attr9; case attr3 = "4" { layer_max = 0; } + case attr3 = "3" { + label = "ðàçîáð."; + layer_max = 0; + } } // Æåë. äîðîãè óçêîêîëåéíûå object "61112000" { @@ -1713,6 +1765,12 @@ line = 0x14; layer_min = 0; layer_max = 1; + label = attr9; + case attr3 = "3" { + label = "ðàçîáð."; + line = 0x14; + layer_max = 0; + } } // Æåë. äîðîãè ìîíîðåëüñîâûå object "61113000" { @@ -1785,6 +1843,7 @@ line = 0x03; layer_min = 0; layer_max = 2; + label = attr9; } // Àâòîäîðîãè áåç ïîêðûòèÿ object "61310000" { @@ -1792,6 +1851,7 @@ line = 0x0A; layer_min = 0; layer_max = 1; + label = attr9; } // Ãðóíòîâûå ïðîñåëî÷íûå äîðîãè object "61320000" { @@ -1801,6 +1861,7 @@ line = 0x0A; layer_min = 0; layer_max = 1; + label = attr9; } // Ïîëåâûå è ëåñíûå äîðîãè object "61330000" { @@ -1915,6 +1976,7 @@ point = 0x2000; layer_min = 0; layer_max = 2; + label = attr9; } // Ñòàíöèè âñåõ êëàññîâ object "62131000" { @@ -1923,6 +1985,7 @@ point = 0x2000; layer_min = 0; layer_max = 2; + label = attr9; } // Ñòàíöèè ìåòðîïîëèòåíà object "62132000" { @@ -1939,6 +2002,7 @@ point = 0x2700; layer_min = 0; layer_max = 0; + label = attr9; } // Ïëàòôîðìû object "62134000" { @@ -1947,6 +2011,7 @@ point = 0x2700; layer_min = 0; layer_max = 0; + label = attr9; } // Ïîãðóçî÷íî-ðàçãðóç. ïëîùàäêè object "62135000" { @@ -1961,6 +2026,7 @@ point = 0x0100; layer_min = 0; layer_max = 0; + label = attr9; } // Áëîêïîñòû object "62141000" { @@ -2014,6 +2080,12 @@ layer_min = 0; layer_max = 0; } +// Ìîñò +object "62310000" { + export = false; + layer_min = 0; + layer_max = 0; +} // Ìîñòû íà îáù. ïðîëåòíîì îñíîâ. object "62311000" { export = true; @@ -2561,6 +2633,7 @@ polygon = 0x51; layer_min = 0; layer_max = 0; + label = attr9; } // Ñîëîí÷àêè object "72320000" { @@ -2602,6 +2675,7 @@ point = 0x660F; layer_min = 0; layer_max = 0; + label = attr9; } // Êîïåö object "81130000" { @@ -2622,10 +2696,5 @@ line = 0x1C; layer_min = 0; layer_max = 0; -} -// Ìîñò -object "62310000" { - export = false; - layer_min = 0; - layer_max = 0; + label = attr9; } Index: eval.h =================================================================== RCS file: /cvsroot/cmap/cmap/eval.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- eval.h 16 May 2004 12:22:59 -0000 1.3 +++ eval.h 16 May 2004 17:22:21 -0000 1.4 @@ -1,6 +1,8 @@ #ifndef __CMAP_EVAL_H__ #define __CMAP_EVAL_H__ +#include <string> + #include "IngitFile.h" typedef struct { @@ -18,6 +20,8 @@ int layerMin; int layerMax; + std::string label; + //HACK until everything is cleaned out int typePoint; int typeLine; Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- PolishFormat.cpp 16 May 2004 13:48:57 -0000 1.30 +++ PolishFormat.cpp 16 May 2004 17:22:21 -0000 1.31 @@ -146,6 +146,7 @@ img_Layer_min = o.layerMin; //if (img_Layer_max > 3 ) img_Layer_max = 3; + DosToWin(rus_name, (BYTE *)o.label.c_str()); if (num_array == 1) obj[NumObj].Cod[0] = 'P'; @@ -170,299 +171,6 @@ COD = atoi (obj[NumObj].Cod + 1); switch (COD) { [...973 lines suppressed...] - //printf ("%s ", obj[NumObj].Cod); - //for (int i1=1; i1 < 104; i1++){ - // if (obj[NumObj].atr_cod[i1][0] != 0){ - //DosToWin(atr_name, (BYTE *)obj[NumObj].atr_cod[i1]); - // printf ("(%i) %s ", i1, obj[NumObj].atr_cod[i1]); - // } - //} - //printf ("\n"); - //ch = getch(); - break; + } + // àòðèáóò 64 "Ãîðîäñêîé àäðåñ" + DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[64]); + img_Layer_max = 0; + } else + // àòðèáóò 01 "Èìÿ (íîìåð) îáúåêòà, òåêñò" + DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[1]); } // Òîëüêî Äëÿ ÒÎÏÎ Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/eval.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- eval.cpp 16 May 2004 12:22:59 -0000 1.3 +++ eval.cpp 16 May 2004 17:22:21 -0000 1.4 @@ -74,7 +74,7 @@ } void StringAssign::exec(const h_object *obj, ObjectProp &o, int) { - lvalue->setValue(o, rvalue->getValue(obj)); + lvalue->setValue(o, rvalue->getValue(obj, o)); } void BoolAssign::exec(const h_object *obj, ObjectProp &o, int numArray) { Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- evalImpl.h 16 May 2004 13:48:57 -0000 1.4 +++ evalImpl.h 16 May 2004 17:22:21 -0000 1.5 @@ -10,7 +10,7 @@ class StringExpr { public: - virtual std::string getValue(const h_object *obj) = 0; + virtual std::string getValue(const h_object *obj, const ObjectProp &o) = 0; }; class StringLVar : public StringExpr { @@ -18,12 +18,22 @@ virtual void setValue(ObjectProp &o, std::string &value) = 0; }; +class LabelLVar : public StringLVar { + virtual std::string getValue(const h_object *, const ObjectProp &o) { + return o.label; + } + + virtual void setValue(ObjectProp &o, std::string &value) { + o.label = value; + } +}; + class StringConst : public StringExpr { public: StringConst(const std::string &_value) : value(_value) { } - virtual std::string getValue(const h_object *) { + virtual std::string getValue(const h_object *, const ObjectProp &) { return value; } protected: @@ -38,7 +48,7 @@ AttrVar(int _n) : n(_n) { } - virtual std::string getValue(const h_object *obj) { + virtual std::string getValue(const h_object *obj, const ObjectProp &) { if (obj->atr_cod[n] == NULL) return ""; return obj->atr_cod[n]; @@ -310,8 +320,8 @@ EQStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const h_object *obj, const ObjectProp &, int) { - return expr1->getValue(obj) == expr2->getValue(obj); + virtual bool getValue(const h_object *obj, const ObjectProp &o, int) { + return expr1->getValue(obj, o) == expr2->getValue(obj, o); } }; @@ -320,8 +330,56 @@ NEStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const h_object *obj, const ObjectProp &, int) { - return expr1->getValue(obj) != expr2->getValue(obj); + virtual bool getValue(const h_object *obj, const ObjectProp &o, int) { + return expr1->getValue(obj, o) != expr2->getValue(obj, o); + } +}; + +class SetVar { +public: + virtual bool getIn(const h_object *obj, int index) = 0; +}; + +class AttrSetVar : public SetVar { +public: + virtual bool getIn(const h_object *obj, int index) { + return obj->atr_cod[index] != NULL; + } +}; + +class SetExpr : public BoolExpr { +}; + +class BinarySetExpr : public SetExpr { +public: + BinarySetExpr(SetVar *_expr1, IntExpr *_expr2) : expr1(_expr1), expr2(_expr2) { + } + + SetVar *expr1; + IntExpr *expr2; +}; + +class InExpr : public BinarySetExpr { +public: + InExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + int index = expr2->getValue(obj, o, numArray); + ASSERT(index < 120); + return expr1->getIn(obj, index); + } +}; + +class NotInExpr : public BinarySetExpr { +public: + NotInExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + int index = expr2->getValue(obj, o, numArray); + ASSERT(index < 120); + return !expr1->getIn(obj, index); } }; |
From: Denis P. <dy...@us...> - 2004-05-16 17:19:47
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11191 Modified Files: tokenizer.h tokenizer.cpp Log Message: Allow to use lineno with const object Index: tokenizer.h =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tokenizer.h 16 May 2004 13:48:57 -0000 1.3 +++ tokenizer.h 16 May 2004 17:19:39 -0000 1.4 @@ -51,7 +51,7 @@ void commentChar(char c); void eolIsSignificant(bool b); - long lineno(); + long lineno() const; void lowerCaseMode(bool b); int nextToken(); void nextToEOL(bool strip); Index: tokenizer.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tokenizer.cpp 16 May 2004 13:48:57 -0000 1.3 +++ tokenizer.cpp 16 May 2004 17:19:39 -0000 1.4 @@ -71,7 +71,7 @@ eolIsSignificantP = b; } -long Tokenizer::lineno() { +long Tokenizer::lineno() const { return LINENO; } |
From: Denis P. <dy...@us...> - 2004-05-16 13:49:06
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv485 Modified Files: IngitFile.h PolishFormat.cpp evalImpl.h parser.cpp tokenizer.cpp tokenizer.h topo.conf Log Message: - implement string compare expressions - implement attrNUM string var - move everything we support from PolishFormat.cpp to topo.conf Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- parser.cpp 16 May 2004 12:22:59 -0000 1.4 +++ parser.cpp 16 May 2004 13:48:57 -0000 1.5 @@ -38,6 +38,9 @@ case TT_WORD: printf("word: %s\n", t.sval.c_str()); break; + case TT_STRING: + printf("string: %s\n", t.sval.c_str()); + break; default: printf("char: %c\n", (unsigned char)t.ttype); break; @@ -138,6 +141,13 @@ } StringExpr *parseStringVar(const std::string &varName) { + if (strncmp(varName.c_str(), "attr", 4) == 0) { // attrNUM var + char *err; + long n = strtol(varName.c_str() + 4, &err, 10); + if ((*err != 0) || (n > 110)) + throw ParserException(("Unknown variable: " + varName).c_str()); + return new AttrVar(n); + } return NULL; } @@ -159,6 +169,22 @@ } } +StringExpr *parseStringExpr(Tokenizer &t) { + switch (t.nextToken()) { + case TT_STRING: + return new StringConst(t.sval); + case TT_WORD: + { + StringExpr *e = parseStringVar(t.sval); + if (e != NULL) + return e; + throw ParserException(("Unknown variable: " + t.sval).c_str()); + } + default: + throw ParserException("String expression expected"); + } +} + BoolExpr *parseBoolExpr(Tokenizer &t) { if (t.nextToken() == '!') return new NotExpr(parseBoolExpr(t)); @@ -201,7 +227,16 @@ throw ParserException("Expect =, !=, >, <, >=, <="); }; } else if ((se = parseStringVar(t.sval)) != NULL) { - throw ParserException("String expressions are not supported yet"); + switch (t.nextToken()) { + case '=': + return new EQStringExpr(se, parseStringExpr(t)); + case '!': + if (t.nextToken() != '=') + throw ParserException("Expect !="); + return new NEStringExpr(se, parseStringExpr(t)); + default: + throw ParserException("Expected = or !="); + } // } else if ((SetExpr *l = parseSetVar(t.sval) != NULL) { } else throw ParserException(("Unknown variable: " + t.sval).c_str()); @@ -247,7 +282,7 @@ if (t.sval != "object") throw ParserException("Expected 'object'"); - if (t.nextToken() != TT_WORD) + if (t.nextToken() != TT_STRING) throw ParserException("Expected object code"); if (t.sval.length() > 8) Index: IngitFile.h =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- IngitFile.h 5 May 2004 17:00:27 -0000 1.9 +++ IngitFile.h 16 May 2004 13:48:57 -0000 1.10 @@ -17,7 +17,7 @@ unsigned short ATR_num; //Íîìåð â òàáëèöå Îáúåêòîâ Àòðèáóòîâ char Cod[10]; //(P,L,A) + Êîäèôèêàòîð char atr_name[256]; // Çíà÷åíèå àòðèáóòà. - char *atr_cod[110]; // 2 áàéòà àòðèáóòà åñëè íåò 1-é áàéò 0 + char *atr_cod[120]; // 2 áàéòà àòðèáóòà åñëè íåò 1-é áàéò 0 } h_object #ifdef __GNUC__ __attribute__ ((packed)) Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- topo.conf 16 May 2004 12:22:59 -0000 1.3 +++ topo.conf 16 May 2004 13:48:57 -0000 1.4 @@ -546,6 +546,11 @@ polygon = 0x46; layer_min = 0; layer_max = 1; + case attr35 = "5" { + line = 0x26; + polygon = 0x4C; + layer_max = 0; + } } // Ðó÷üè object "31420000" { @@ -555,6 +560,10 @@ polygon = 0x46; layer_min = 0; layer_max = 0; + case attr35 = "5" { + line = 0x26; + polygon = 0x4C; + } } // Êàíàëû object "31431000" { @@ -974,6 +983,12 @@ polygon = 0x01; layer_min = 0; layer_max = 3; + case attr43 = "9" { + point = 0x4; + } + case attr43 = "5" { + point = 0x3; + } } // Ïîñåëêè ãîðîäñêîãî òèïà (ïãò) object "41200000" { @@ -984,6 +999,9 @@ polygon = 0x02; layer_min = 0; layer_max = 3; + case attr43 = "9" { + point = 0x4; + } } // Ïîñåëêè ñåëüñêîãî òèïà object "42100000" { @@ -994,6 +1012,13 @@ polygon = 0x03; layer_min = 0; layer_max = 2; + case attr43 = "9" { + point = 0x4; + } + case attr3 = "6" { + point = 0x8; + layer_max = 0; + } } // Îòäåëüíûå äâîðû (õóòîðà) object "42200000" { @@ -1678,6 +1703,9 @@ line = 0x14; layer_min = 0; layer_max = 3; + case attr3 = "4" { + layer_max = 0; + } } // Æåë. äîðîãè óçêîêîëåéíûå object "61112000" { Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- PolishFormat.cpp 16 May 2004 12:22:59 -0000 1.29 +++ PolishFormat.cpp 16 May 2004 13:48:57 -0000 1.30 @@ -579,8 +579,6 @@ img_Layer_max = 0; //printf ("3 %s\n", obj[NumObj].atr_cod[3]); } - if (obj[NumObj].atr_cod[3] != 0 && obj[NumObj].atr_cod[3][0] == '4') - img_Layer_max = 0; if (obj[NumObj].atr_cod[3] != 0 && obj[NumObj].atr_cod[3][0] == '1') { //img_Layer_max = 2; //printf ("3 %s\n", obj[NumObj].atr_cod[3]); @@ -638,12 +636,6 @@ img_Layer_max = img_Layer_max_orig + 2; // if (obj[NumObj].atr_cod[32] != 0 && obj[NumObj].atr_cod[32][0] == '1') // 32 Ïðèçíàê ñóäîõîäñòâà img_Layer_max = img_Layer_max_orig + 2; - if (obj[NumObj].atr_cod[35] != 0 && obj[NumObj].atr_cod[35][0] == '5') { - // 5 - îñûõàþùèé - Type_line = 0x26; - Type_poly = 0x4c; - img_Layer_max = 0; - } //if (obj[NumObj].atr_cod[35][0] == '2'){ // 1- íàçåìíûé // 2- ïîäçåìíûé @@ -686,13 +678,6 @@ //Type_poly = 0x46; //Type_line = 0x18; //img_Layer_max = 0; - if (obj[NumObj].atr_cod[35] != 0 && obj[NumObj].atr_cod[35][0] == '5') { - // 5 - îñûõàþùèé - Type_poly = 0x4c; - Type_line = 0x26; - //printf ("%s\n", obj[NumObj].atr_cod[35]); - //ch = getch(); - } DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); break; @@ -727,14 +712,6 @@ //img_Layer_max = 2; Type_point = 0x03; } - if (obj[NumObj].atr_cod[43] != 0 && obj[NumObj].atr_cod[43][0] == '9') { - //img_Layer_max = 2; - Type_point = 0x04; // Öåíòð ðàéîíà - } - if (obj[NumObj].atr_cod[43] != 0 && obj[NumObj].atr_cod[43][0] == '5') { - //img_Layer_max = 2; - Type_point = 0x03; // Öåíòð îáëàñòè - } DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') // obj[NumObj].Cod[0] = 'P'; @@ -755,10 +732,6 @@ //RGN_point = 0x20; //img_Layer_max = 1; //Type_point = 0x06; - if (obj[NumObj].atr_cod[43] != 0 && obj[NumObj].atr_cod[43][0] == '9') { - //img_Layer_max = 2; - Type_point = 0x04; // Öåíòð ðàéîíà - } DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') // obj[NumObj].Cod[0] = 'P'; @@ -771,15 +744,6 @@ //RGN_point = 0x20; //img_Layer_max = 1; //Type_point = 0x07; - if (obj[NumObj].atr_cod[43] != 0 && obj[NumObj].atr_cod[43][0] == '9') { - //img_Layer_max = 2; - Type_point = 0x04; // Öåíòð ðàéîíà - } - if (obj[NumObj].atr_cod[3] != 0 && obj[NumObj].atr_cod[3][0] == '6') { - // Íå æèëîé - img_Layer_max = 0; - Type_point = 0x08; - } DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); //if (comm_sity == 1 && obj[NumObj].Cod[0] != 'D') // obj[NumObj].Cod[0] = 'P'; Index: tokenizer.h =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tokenizer.h 15 May 2004 17:47:04 -0000 1.2 +++ tokenizer.h 16 May 2004 13:48:57 -0000 1.3 @@ -33,6 +33,7 @@ const int TT_EOL = -2; const int TT_NUMBER = -3; const int TT_WORD = -4; +const int TT_STRING = -5; const short CT_WHITESPACE = 1; const short CT_DIGIT = 2; Index: tokenizer.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tokenizer.cpp 15 May 2004 17:47:04 -0000 1.2 +++ tokenizer.cpp 16 May 2004 13:48:57 -0000 1.3 @@ -245,7 +245,7 @@ throw TokenizerException("CR or LF not allowed in quote."); if (peekc == ttype) // keep \n or \r intact in peekc peekc = read(); - return ttype = TT_WORD; + return ttype = TT_STRING; } if (c == '/' && (slashSlashCommentsP || slashStarCommentsP)) { Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- evalImpl.h 16 May 2004 12:22:59 -0000 1.3 +++ evalImpl.h 16 May 2004 13:48:57 -0000 1.4 @@ -15,19 +15,38 @@ class StringLVar : public StringExpr { public: - virtual std::string getValue(const h_object *obj) = 0; virtual void setValue(ObjectProp &o, std::string &value) = 0; }; class StringConst : public StringExpr { public: - virtual std::string getValue(const h_object *obj) { + StringConst(const std::string &_value) : value(_value) { + } + + virtual std::string getValue(const h_object *) { return value; } protected: std::string value; }; +class StringRVar : public StringExpr { +}; + +class AttrVar : public StringRVar { +public: + AttrVar(int _n) : n(_n) { + } + + virtual std::string getValue(const h_object *obj) { + if (obj->atr_cod[n] == NULL) + return ""; + return obj->atr_cod[n]; + } + + int n; +}; + class IntExpr { public: virtual int getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; @@ -277,6 +296,35 @@ } }; +class BinaryStringExpr : public BoolExpr { +public: + BinaryStringExpr(StringExpr *_expr1, StringExpr *_expr2) : expr1(_expr1), expr2(_expr2) { + } + + StringExpr *expr1; + StringExpr *expr2; +}; + +class EQStringExpr : public BinaryStringExpr { +public: + EQStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &, int) { + return expr1->getValue(obj) == expr2->getValue(obj); + } +}; + +class NEStringExpr : public BinaryStringExpr { +public: + NEStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &, int) { + return expr1->getValue(obj) != expr2->getValue(obj); + } +}; + class Case; class Block { |
From: Denis P. <dy...@us...> - 2004-05-16 12:23:10
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15816 Modified Files: PolishFormat.cpp eval.cpp eval.h evalImpl.h parser.cpp topo.conf Log Message: - implement first version of case - boolean expressions for case support boolean constants, boolean vars, binary exprs with integers. No compound bool exprs supported yet. - Removed usage of LEN_area from code. It is replaced with config entries. Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- parser.cpp 16 May 2004 04:41:00 -0000 1.3 +++ parser.cpp 16 May 2004 12:22:59 -0000 1.4 @@ -44,73 +44,170 @@ } } -void setValue(ObjectConf &obj, const std::string &varName, Tokenizer &t) { - if ((varName == "export") || (varName == "index")) { // boolean vars +BoolLVar *parseBoolLVar(const std::string &varName) { + if (varName == "export") + return new ExportVar(); + if (varName == "index") + return new IndexVar(); + return NULL; +} + +BoolExpr *parseBoolConst(const std::string &value) { + if (value == "true") + return new BoolConst(true); + if (value == "false") + return new BoolConst(false); + return NULL; +} + +IntLVar *parseIntLVar(const std::string &varName) { + if (varName == "point") + return new PointVar(); + if (varName == "line") + return new LineVar(); + if (varName == "polygon") + return new PolygonVar(); + if (varName == "layer_min") + return new LayerMinVar(); + if (varName == "layer_max") + return new LayerMaxVar(); + return NULL; +} + +IntRVar *parseIntRVar(const std::string &varName) { + if (varName == "square") + return new SquareVar(); + if (varName == "length") + return new LengthVar(); + return NULL; +} + +void setValue(Block *b, const std::string &varName, Tokenizer &t) { + BoolLVar *bVar = parseBoolLVar(varName); + + if (bVar != NULL) { // boolean vars if (t.nextToken() != TT_WORD) throw ParserException("Expected 'true' or 'false'"); BoolAssign *a = new BoolAssign(); - - if (t.sval == "true") - a->rvalue = new BoolConst(true); - else if (t.sval == "false") - a->rvalue = new BoolConst(false); - else + a->lvalue = bVar; + a->rvalue = parseBoolConst(t.sval); + if (a->rvalue == NULL) throw ParserException("Expected 'true' or 'false'"); - - if (varName == "export") - a->lvalue = new ExportVar(); - else if (varName == "index") - a->lvalue = new IndexVar(); - obj.addAssign(a); + + b->addAssign(a); } else { if (t.nextToken() != TT_NUMBER) throw ParserException("Expected number"); - else if (varName == "point") - obj.typePoint = t.nval; - else if (varName == "line") - obj.typeLine = t.nval; - else if (varName == "polygon") - obj.typePoly = t.nval; - else if (varName == "layer_min") { - IntAssign *a = new IntAssign(); - a->lvalue = new LayerMinVar(); - a->rvalue = new IntConst(t.nval); - obj.addAssign(a); - } - else if (varName == "layer_max") { - IntAssign *a = new IntAssign(); - a->lvalue = new LayerMaxVar(); - a->rvalue = new IntConst(t.nval); - obj.addAssign(a); - } - else + IntAssign *a = new IntAssign(); + a->rvalue = new IntConst(t.nval); + + IntLVar *iVar = parseIntLVar(varName); + + if (iVar == NULL) throw ParserException("Invalid variable name"); + + a->lvalue = iVar; + + b->addAssign(a); } } -bool readObject(Tokenizer &t) { +BoolExpr *parseBoolVar(const std::string &varName) { + BoolExpr *e = parseBoolLVar(varName); + + if (e != NULL) // expr is a boolean lvalue var + return e; + +/* Does not have rvalue boolean vars yet + e = parseBoolRVar(t.sval); + + if (e != NULL) // expr is a boolean lvalue var + return e; +*/ + + return NULL; +} + +IntExpr *parseIntVar(const std::string &varName) { + IntExpr *e = parseIntLVar(varName); + if (e != NULL) + return e; + + return parseIntRVar(varName); +} + +StringExpr *parseStringVar(const std::string &varName) { + return NULL; +} + +IntExpr *parseIntExpr(Tokenizer &t) { switch (t.nextToken()) { - case TT_EOF: - return false; + case TT_NUMBER: + return new IntConst(t.nval); case TT_WORD: - break; + { + IntExpr *e = parseIntLVar(t.sval); + if (e != NULL) + return e; + if ((e = parseIntRVar(t.sval)) != NULL) + return e; + throw ParserException(("Unknown variable: " + t.sval).c_str()); + } default: - throw ParserException("Expected 'object'"); + throw ParserException("Integer expression expected"); } +} - if (t.sval != "object") - throw ParserException("Expected 'object'"); +BoolExpr *parseBoolExpr(Tokenizer &t) { + if (t.nextToken() == '!') + return new NotExpr(parseBoolExpr(t)); - if (t.nextToken() != TT_WORD) - throw ParserException("Expected object code"); + if (t.ttype != TT_WORD) + throw ParserException("Boolean expression expected"); - if (t.sval.length() > 8) - throw ParserException("Object code is longer than 8"); + BoolExpr *e = parseBoolConst(t.sval); - ObjectConf obj; - strcpy(obj.object_cod, t.sval.c_str()); + if (e != NULL) // expr is a const + return e; + + if ((e = parseBoolVar(t.sval)) != NULL) // expr is a bool var + return e; + + IntExpr *ie; + StringExpr *se; + + if ((ie = parseIntVar(t.sval)) != NULL) { + switch (t.nextToken()) { + case '=': + return new EQIntExpr(ie, parseIntExpr(t)); + case '!': + if (t.nextToken() != '=') + throw ParserException("Expect !="); + return new NEIntExpr(ie, parseIntExpr(t)); + case '>': + if (t.nextToken() != '=') { + t.pushBack(); + return new GTIntExpr(ie, parseIntExpr(t)); + } else + return new GEIntExpr(ie, parseIntExpr(t)); + case '<': + if (t.nextToken() != '=') { + t.pushBack(); + return new LTIntExpr(ie, parseIntExpr(t)); + } else + return new LEIntExpr(ie, parseIntExpr(t)); + default: + throw ParserException("Expect =, !=, >, <, >=, <="); + }; + } else if ((se = parseStringVar(t.sval)) != NULL) { + throw ParserException("String expressions are not supported yet"); +// } else if ((SetExpr *l = parseSetVar(t.sval) != NULL) { + } else + throw ParserException(("Unknown variable: " + t.sval).c_str()); +} +void parseBlock(Tokenizer &t, Block *b) { if (t.nextToken() != '{') throw ParserException("Expected '{'"); @@ -121,15 +218,46 @@ break; if (t.ttype != TT_WORD) throw ParserException("Expected variable name or '}'"); - varName = t.sval; + if (t.sval == "case") { + Case *c = new Case(parseBoolExpr(t)); + parseBlock(t, c); + b->addCase(c); + } else { + varName = t.sval; - if (t.nextToken() != '=') - throw ParserException("Expected '='"); - setValue(obj, varName, t); - if (t.nextToken() != ';') - throw ParserException("Expected ';'"); + if (t.nextToken() != '=') + throw ParserException("Expected '='"); + setValue(b, varName, t); + if (t.nextToken() != ';') + throw ParserException("Expected ';'"); + } + } +} + +bool readObject(Tokenizer &t) { + switch (t.nextToken()) { + case TT_EOF: + return false; + case TT_WORD: + break; + default: + throw ParserException("Expected 'object'"); } + if (t.sval != "object") + throw ParserException("Expected 'object'"); + + if (t.nextToken() != TT_WORD) + throw ParserException("Expected object code"); + + if (t.sval.length() > 8) + throw ParserException("Object code is longer than 8"); + + ObjectConf *obj = new ObjectConf(); + strcpy(obj->object_cod, t.sval.c_str()); + + parseBlock(t, &obj->block); + addObjectConf(obj); return true; Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- topo.conf 16 May 2004 04:41:00 -0000 1.2 +++ topo.conf 16 May 2004 12:22:59 -0000 1.3 @@ -370,6 +370,12 @@ polygon = 0x3C; layer_min = 0; layer_max = 2; + case length < 50000 { + layer_max = 0; + } + case length < 100000 { + layer_max = 1; + } } // Âîäîõðàíèëèùà object "31131000" { Index: eval.h =================================================================== RCS file: /cvsroot/cmap/cmap/eval.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- eval.h 16 May 2004 04:41:00 -0000 1.2 +++ eval.h 16 May 2004 12:22:59 -0000 1.3 @@ -24,7 +24,7 @@ int typePoly; } ObjectProp; -bool evalObjectProp(const h_object *obj, ObjectProp &o); +bool evalObjectProp(const h_object *obj, ObjectProp &o, int numArray); void clearWarnedEval(); #endif Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- PolishFormat.cpp 16 May 2004 11:07:42 -0000 1.28 +++ PolishFormat.cpp 16 May 2004 12:22:59 -0000 1.29 @@ -128,8 +128,10 @@ continue; } + num_array = ReadMetric(NumObj, Maps, latSW, lonSW, latNE, lonNE); + // Ïðîâåðêà íà EXPORT - if (!evalObjectProp(obj + NumObj, o)) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ + if (!evalObjectProp(obj + NumObj, o, num_array)) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ continue; if (o.index) @@ -144,7 +146,6 @@ img_Layer_min = o.layerMin; //if (img_Layer_max > 3 ) img_Layer_max = 3; - num_array = ReadMetric(NumObj, Maps, latSW, lonSW, latNE, lonNE); if (num_array == 1) obj[NumObj].Cod[0] = 'P'; @@ -668,16 +669,6 @@ //if (obj[NumObj].atr_cod[9][0] != 0){ // img_Layer_max = 1; // Èìååò èìÿ //} - if (LEN_area (num_array) >= 50000) { - //printf ("\n %f\n", LEN_area (num_array, NumObj)); - //printf ("%s \n", obj[NumObj].atr_cod[9]); - img_Layer_max = 1; - } - if (LEN_area (num_array) >= 100000) { - //printf ("\n %f\n", LEN_area (num_array, NumObj)); - //printf ("%s \n", obj[NumObj].atr_cod[9]); - img_Layer_max = 2; - } DosToWin(rus_name, (BYTE *)obj[NumObj].atr_cod[9]); break; //========================================================== Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/eval.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- eval.cpp 16 May 2004 04:41:00 -0000 1.2 +++ eval.cpp 16 May 2004 12:22:59 -0000 1.3 @@ -4,28 +4,27 @@ #include "eval.h" #include "evalImpl.h" -static ObjectConf *objs = NULL; -static unsigned int objSize = 0; -static unsigned int objLen = 0; +static ObjectConf *firstObj = NULL; +static ObjectConf *lastObj = NULL; -void addObjectConf(ObjectConf &obj) { - if (objs == NULL) { - objSize = 256; - objs = (ObjectConf *)s_malloc(sizeof(ObjectConf) * objSize); - } else if (objSize == objLen) { - objSize *= 2; - objs = (ObjectConf *)s_realloc(objs, sizeof(ObjectConf) * objSize); +void addObjectConf(ObjectConf *obj) { + if (firstObj == NULL) { + firstObj = obj; + lastObj = obj; + } else { + lastObj->next = obj; + lastObj = obj; } - objs[objLen] = obj; - objLen++; } void clearObjectConf() { - if (objs != NULL) { - s_free(objs); - objLen = 0; - objSize = 0; + while (firstObj != NULL) { + lastObj = firstObj; + firstObj = firstObj->next; + delete lastObj; } + + lastObj = NULL; } static char const **warnedCODs = NULL; @@ -55,10 +54,14 @@ warnedCODsize = 0; } -bool evalObjectProp(const h_object *obj, ObjectProp &o) { - for (unsigned int i = 0; i < objLen; i++) - if (strcmp(objs[i].object_cod, obj->Cod + 1) == 0) - return objs[i].handle(obj, o); +bool evalObjectProp(const h_object *obj, ObjectProp &o, int numArray) { + ObjectConf *objConf = firstObj; + + while (objConf != NULL) { + if (strcmp(objConf->object_cod, obj->Cod + 1) == 0) + return objConf->handle(obj, o, numArray); + objConf = objConf->next; + } ASSERT(obj->Cod[1] != 0); if (!checkWarned(obj->Cod + 1)) @@ -66,38 +69,72 @@ return false; } -void IntAssign::exec(const h_object *obj, ObjectProp &o) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void IntAssign::exec(const h_object *obj, ObjectProp &o, int numArray) { + lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); } -void StringAssign::exec(const h_object *obj, ObjectProp &o) { +void StringAssign::exec(const h_object *obj, ObjectProp &o, int) { lvalue->setValue(o, rvalue->getValue(obj)); } -void BoolAssign::exec(const h_object *obj, ObjectProp &o) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void BoolAssign::exec(const h_object *obj, ObjectProp &o, int numArray) { + lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); } -bool ObjectConf::handle(const h_object *obj, ObjectProp &o) { +void Block::exec(const h_object *obj, ObjectProp &o, int numArray) { + for (Assign *a = first; a != NULL; a = a->next) + a->exec(obj, o, numArray); + for (Case *c = firstCase; c != NULL; c = c->next) + c->exec(obj, o, numArray); +} + +void Block::addAssign(Assign *a) { + if (first == NULL) { + first = a; + last = a; + } else { + last->next = a; + last = a; + } +} + +void Block::addCase(Case *a) { + if (firstCase == NULL) { + firstCase = a; + lastCase = a; + } else { + lastCase->next = a; + lastCase = a; + } +} + +void Case::exec(const h_object *obj, ObjectProp &o, int numArray) { + if (expr->getValue(obj, o, numArray)) + Block::exec(obj, o, numArray); +} + +bool ObjectConf::handle(const h_object *obj, ObjectProp &o, int numArray) { memset(&o, 0, sizeof(ObjectProp)); + o.typePoint = -1; + o.typeLine = -1; + o.typePoly = -1; - for (Assign *a = first; a != NULL; a = a->next) - a->exec(obj, o); + block.exec(obj, o, numArray); if (!o.doExport) return false; switch (obj->Cod[0]) { case 'P': - o.type = typePoint; + o.type = o.typePoint; o.objectType = ObjectProp::POINT; break; case 'L': - o.type = typeLine; + o.type = o.typeLine; o.objectType = ObjectProp::LINE; break; case 'A': - o.type = typePoly; + o.type = o.typePoly; o.objectType = ObjectProp::POLYGON; break; default: @@ -105,9 +142,5 @@ exit(1); } - o.typePoint = typePoint; - o.typeLine = typeLine; - o.typePoly = typePoly; - return true; } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- evalImpl.h 16 May 2004 04:41:00 -0000 1.2 +++ evalImpl.h 16 May 2004 12:22:59 -0000 1.3 @@ -6,13 +6,14 @@ #include "eval.h" #include "IngitFile.h" +#include "Geodesy.h" class StringExpr { public: virtual std::string getValue(const h_object *obj) = 0; }; -class StringVar : public StringExpr { +class StringLVar : public StringExpr { public: virtual std::string getValue(const h_object *obj) = 0; virtual void setValue(ObjectProp &o, std::string &value) = 0; @@ -29,17 +30,17 @@ class IntExpr { public: - virtual int getValue(const h_object *obj, const ObjectProp &o) = 0; + virtual int getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; }; -class IntVar : public IntExpr { +class IntLVar : public IntExpr { public: - virtual int getValue(const h_object *obj, const ObjectProp &o) = 0; + virtual int getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; virtual void setValue(ObjectProp &o, int value) = 0; }; -class LayerMinVar : public IntVar { - virtual int getValue(const h_object *, const ObjectProp &o) { +class LayerMinVar : public IntLVar { + virtual int getValue(const h_object *, const ObjectProp &o, int) { return o.layerMin; } @@ -48,8 +49,8 @@ } }; -class LayerMaxVar : public IntVar { - virtual int getValue(const h_object *, const ObjectProp &o) { +class LayerMaxVar : public IntLVar { + virtual int getValue(const h_object *, const ObjectProp &o, int) { return o.layerMax; } @@ -58,26 +59,100 @@ } }; +class PointVar : public IntLVar { + virtual int getValue(const h_object *, const ObjectProp &o, int) { + return o.typePoint; + } + + virtual void setValue(ObjectProp &o, int value) { + o.typePoint = value; + } +}; + +class LineVar : public IntLVar { + virtual int getValue(const h_object *, const ObjectProp &o, int numArray) { + return o.typeLine; + } + + virtual void setValue(ObjectProp &o, int value) { + o.typeLine = value; + } +}; + +class PolygonVar : public IntLVar { + virtual int getValue(const h_object *, const ObjectProp &o, int numArray) { + return o.typePoly; + } + + virtual void setValue(ObjectProp &o, int value) { + o.typePoly = value; + } +}; + +class IntRVar : public IntExpr { +}; + +class SquareVar : public IntRVar { + virtual int getValue(const h_object *obj, const ObjectProp &o, int numArray) { + if (obj->Cod[0] == 'A') + return (int)SQU_area(numArray); + return 0; + } +}; + +class LengthVar : public IntRVar { + virtual int getValue(const h_object *, const ObjectProp &o, int numArray) { + if (obj->Cod[0] == 'A' || obj->Cod[0] == 'L') + return (int)LEN_area(numArray); + return 0; + } +}; + class IntConst : public IntExpr { public: IntConst(int _value) : value(_value) { }; - virtual int getValue(const h_object *, const ObjectProp &) { + virtual int getValue(const h_object *, const ObjectProp &, int) { return value; } protected: int value; }; +class Assign { +public: + Assign() : next(NULL) { + } + + virtual void exec(const h_object *obj, ObjectProp &o, int numArray) = 0; + + Assign *next; +}; + +class StringAssign : public Assign { +public: + StringLVar *lvalue; + StringExpr *rvalue; + + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); +}; + +class IntAssign : public Assign { +public: + IntLVar *lvalue; + IntExpr *rvalue; + + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); +}; + class BoolExpr { public: - virtual bool getValue(const h_object *obj, const ObjectProp &o) = 0; + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) = 0; }; -class BoolVar : public BoolExpr { +class BoolLVar : public BoolExpr { public: - virtual bool getValue(const h_object *obj, const ObjectProp &o) = 0; virtual void setValue(ObjectProp &o, bool value) = 0; }; @@ -86,15 +161,15 @@ BoolConst(bool _value) : value(_value) { }; - virtual bool getValue(const h_object *, const ObjectProp &) { + virtual bool getValue(const h_object *, const ObjectProp &, int) { return value; } protected: bool value; }; -class ExportVar : public BoolVar { - virtual bool getValue(const h_object *, const ObjectProp &o) { +class ExportVar : public BoolLVar { + virtual bool getValue(const h_object *, const ObjectProp &o, int) { return o.doExport; } @@ -103,8 +178,8 @@ } }; -class IndexVar : public BoolVar { - virtual bool getValue(const h_object *, const ObjectProp &o) { +class IndexVar : public BoolLVar { + virtual bool getValue(const h_object *, const ObjectProp &o, int) { return o.index; } @@ -113,46 +188,131 @@ } }; -class Assign { +class NotExpr : public BoolExpr { public: - Assign() : next(NULL) { + NotExpr(BoolExpr *_expr) : expr(_expr) { } - virtual void exec(const h_object *obj, ObjectProp &o) = 0; + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return !expr->getValue(obj, o, numArray); + } - Assign *next; + BoolExpr *expr; }; -class StringAssign : public Assign { +class BoolAssign : public Assign { public: - StringVar *lvalue; - StringExpr *rvalue; + BoolLVar *lvalue; + BoolExpr *rvalue; - virtual void exec(const h_object *obj, ObjectProp &o); + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); }; -class IntAssign : public Assign { +class BinaryIntExpr : public BoolExpr { public: - IntVar *lvalue; - IntExpr *rvalue; + BinaryIntExpr(IntExpr *_expr1, IntExpr *_expr2) : expr1(_expr1), expr2(_expr2) { + } - virtual void exec(const h_object *obj, ObjectProp &o); + IntExpr *expr1; + IntExpr *expr2; }; -class BoolAssign : public Assign { +class EQIntExpr : public BinaryIntExpr { public: - BoolVar *lvalue; - BoolExpr *rvalue; + EQIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } - virtual void exec(const h_object *obj, ObjectProp &o); + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) == expr2->getValue(obj, o, numArray); + } +}; + +class NEIntExpr : public BinaryIntExpr { +public: + NEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) != expr2->getValue(obj, o, numArray); + } +}; + +class GEIntExpr : public BinaryIntExpr { +public: + GEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) >= expr2->getValue(obj, o, numArray); + } +}; + +class GTIntExpr : public BinaryIntExpr { +public: + GTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) > expr2->getValue(obj, o, numArray); + } +}; + +class LEIntExpr : public BinaryIntExpr { +public: + LEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) <= expr2->getValue(obj, o, numArray); + } +}; + +class LTIntExpr : public BinaryIntExpr { +public: + LTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { + } + + virtual bool getValue(const h_object *obj, const ObjectProp &o, int numArray) { + return expr1->getValue(obj, o, numArray) < expr2->getValue(obj, o, numArray); + } +}; + +class Case; + +class Block { +public: + Block() : first(NULL), last(NULL), firstCase(NULL), lastCase(NULL) { + } + + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); + void addAssign(Assign *a); + void addCase(Case *a); + + Assign *first; + Assign *last; + + Case *firstCase; + Case *lastCase; +}; + +class Case : public Block { +public: + Case(BoolExpr *_expr) : Block(), next(NULL), expr(_expr) { + } + + virtual void exec(const h_object *obj, ObjectProp &o, int numArray); + + BoolExpr *expr; + + Case *next; }; class ObjectConf { public: - ObjectConf() : first(NULL), last(NULL) { + ObjectConf() : typePoint(-1), typeLine(-1), typePoly(-1), next(NULL) { } - bool handle(const h_object *obj, ObjectProp &o); + bool handle(const h_object *obj, ObjectProp &o, int numArray); char object_cod[9]; // 8-çíà÷íûé êîäèôèêàòîð ÂÒÓ @@ -160,21 +320,12 @@ int typeLine; int typePoly; - void addAssign(Assign *a) { - if (first == NULL) { - first = a; - last = a; - } else { - last->next = a; - last = a; - } - } + Block block; - Assign *first; - Assign *last; + ObjectConf *next; }; -void addObjectConf(ObjectConf &obj); +void addObjectConf(ObjectConf *obj); void clearObjectConf(); #endif |
From: Denis P. <dy...@us...> - 2004-05-16 12:20:52
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15424 Modified Files: Geodesy.h Log Message: Indenting Index: Geodesy.h =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Geodesy.h 16 May 2004 11:07:42 -0000 1.6 +++ Geodesy.h 16 May 2004 12:20:40 -0000 1.7 @@ -7,8 +7,8 @@ const double HalfPi = Pi / 2; const double E = log(1.); -double SQU_area (int n); -double LEN_area (int n); +double SQU_area(int n); +double LEN_area(int n); double IngitLat2Degrees(long degrees); double IngitLon2Degrees(long degrees, bool start); |
From: Denis P. <dy...@us...> - 2004-05-16 11:07:52
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27560 Modified Files: PolishFormat.cpp Geodesy.h Geodesy.cpp Log Message: Remove unused param from LEN_area. Remove unused calculations from LEN_area. Index: Geodesy.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Geodesy.cpp 11 May 2004 21:22:50 -0000 1.7 +++ Geodesy.cpp 16 May 2004 11:07:42 -0000 1.8 @@ -39,12 +39,10 @@ } // Âû÷èñëåíèå äëèíû ïîëèãîíà -double LEN_area (int n, int NunObj) { +double LEN_area (int n) { double x, y; double x1, y1; double len = 0; - double area = 0; - double area1 = 0; for (int i = 0; i < n - 1; i++) { if (Metr_OBJ[i].type != 0 && i > 0) @@ -55,9 +53,6 @@ y1 = Metr_OBJ[i + 1].Lat * Ky; len += sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1) ); - - area += ((y + y1) * (x - x1)); - area1 += ((x + x1) * (y - y1)); } return len; Index: Geodesy.h =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Geodesy.h 11 May 2004 21:22:50 -0000 1.5 +++ Geodesy.h 16 May 2004 11:07:42 -0000 1.6 @@ -8,7 +8,7 @@ const double E = log(1.); double SQU_area (int n); -double LEN_area (int n, int NunObj); +double LEN_area (int n); double IngitLat2Degrees(long degrees); double IngitLon2Degrees(long degrees, bool start); Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- PolishFormat.cpp 15 May 2004 18:43:12 -0000 1.27 +++ PolishFormat.cpp 16 May 2004 11:07:42 -0000 1.28 @@ -668,12 +668,12 @@ //if (obj[NumObj].atr_cod[9][0] != 0){ // img_Layer_max = 1; // Èìååò èìÿ //} - if (LEN_area (num_array, NumObj) >= 50000) { + if (LEN_area (num_array) >= 50000) { //printf ("\n %f\n", LEN_area (num_array, NumObj)); //printf ("%s \n", obj[NumObj].atr_cod[9]); img_Layer_max = 1; } - if (LEN_area (num_array, NumObj) >= 100000) { + if (LEN_area (num_array) >= 100000) { //printf ("\n %f\n", LEN_area (num_array, NumObj)); //printf ("%s \n", obj[NumObj].atr_cod[9]); img_Layer_max = 2; |