diff --git a/data/drules_proto.txt b/data/drules_proto.txt index 1616146d7d..89081634be 100644 --- a/data/drules_proto.txt +++ b/data/drules_proto.txt @@ -4719,9 +4719,9 @@ cont { color: 0xD3CB98 priority: 694 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11537 } } @@ -4732,9 +4732,9 @@ cont { color: 0xD3CB98 priority: 735 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11770 } } @@ -5749,9 +5749,9 @@ cont { color: 0xEFADAA priority: 697 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11538 } } @@ -5786,9 +5786,9 @@ cont { color: 0xEFADAA priority: 738 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11771 } } @@ -6370,9 +6370,9 @@ cont { color: 0xD1FAD1 priority: 287 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10609 } } @@ -6383,9 +6383,9 @@ cont { color: 0xD1FAD1 priority: 399 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10820 } } @@ -6396,9 +6396,9 @@ cont { color: 0xD1FAD1 priority: 715 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11546 } } @@ -6409,9 +6409,9 @@ cont { color: 0xD1FAD1 priority: 757 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11779 } } @@ -6825,9 +6825,9 @@ cont { color: 0xD1FAD1 priority: 689 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11532 } } @@ -6838,9 +6838,9 @@ cont { color: 0xD1FAD1 priority: 730 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11765 } } @@ -7762,9 +7762,9 @@ cont { color: 0xE5E0C2 priority: 687 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11529 } } @@ -7775,9 +7775,9 @@ cont { color: 0xE5E0C2 priority: 728 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11762 } } @@ -8283,9 +8283,9 @@ cont { color: 0xE5E0C2 priority: 686 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11528 } } @@ -8296,9 +8296,9 @@ cont { color: 0xE5E0C2 priority: 727 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11761 } } @@ -9665,9 +9665,9 @@ cont { } priority: 397 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10819 } } @@ -9692,9 +9692,9 @@ cont { } priority: 713 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11545 } } @@ -9719,9 +9719,9 @@ cont { } priority: 755 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11778 } } @@ -10195,9 +10195,9 @@ cont { color: 0xFFFFFF priority: 291 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10607 } } @@ -10208,9 +10208,9 @@ cont { color: 0xFFFFFF priority: 395 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10818 } } @@ -10221,9 +10221,9 @@ cont { color: 0xFFFFFF priority: 709 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11544 } } @@ -10234,9 +10234,9 @@ cont { color: 0xFFFFFF priority: 751 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11777 } } @@ -11028,9 +11028,9 @@ cont { color: 0x809BC0 priority: 302 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10625 } } @@ -11041,9 +11041,9 @@ cont { color: 0x809BC0 priority: 410 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10892 } } @@ -11054,9 +11054,9 @@ cont { color: 0x809BC0 priority: 725 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11552 } } @@ -11067,9 +11067,9 @@ cont { color: 0x809BC0 priority: 767 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11785 } } @@ -12334,9 +12334,9 @@ cont { color: 0x809BC0 priority: 299 } - caption { + path_text { height: 8 - stroke_color: 0x0 + color: 0x0 priority: 10617 } } @@ -12347,9 +12347,9 @@ cont { color: 0x809BC0 priority: 407 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 10828 } } @@ -12360,9 +12360,9 @@ cont { color: 0x809BC0 priority: 722 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11459 } } @@ -12373,9 +12373,9 @@ cont { color: 0x809BC0 priority: 764 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11737 } } @@ -13141,9 +13141,9 @@ cont { color: 0xD0D0D0 priority: 693 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11536 } } @@ -13154,9 +13154,9 @@ cont { color: 0xD0D0D0 priority: 734 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11769 } } @@ -13404,9 +13404,9 @@ cont { color: 0xD1FAD1 priority: 690 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11534 } } @@ -13417,9 +13417,9 @@ cont { color: 0xD1FAD1 priority: 731 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11767 } } @@ -14389,9 +14389,9 @@ cont { color: 0xD3CB98 priority: 691 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11535 } } @@ -14402,9 +14402,9 @@ cont { color: 0xD3CB98 priority: 732 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11768 } } @@ -15047,9 +15047,9 @@ cont { color: 0xE5E0C2 priority: 688 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11530 } } @@ -15060,9 +15060,9 @@ cont { color: 0xE5E0C2 priority: 729 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11763 } } @@ -15502,9 +15502,9 @@ cont { color: 0xE46D71 priority: 300 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10623 } } @@ -15515,9 +15515,9 @@ cont { color: 0xE46D71 priority: 408 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10890 } } @@ -15528,9 +15528,9 @@ cont { color: 0xE46D71 priority: 723 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11550 } } @@ -15541,9 +15541,9 @@ cont { color: 0xE46D71 priority: 765 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11783 } } @@ -16444,9 +16444,9 @@ cont { color: 0xE46D71 priority: 297 } - caption { + path_text { height: 8 - stroke_color: 0x0 + color: 0x0 priority: 10615 } } @@ -16457,9 +16457,9 @@ cont { color: 0xE46D71 priority: 405 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 10826 } } @@ -16470,9 +16470,9 @@ cont { color: 0xE46D71 priority: 720 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11457 } } @@ -16483,9 +16483,9 @@ cont { color: 0xE46D71 priority: 762 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11735 } } @@ -17911,9 +17911,9 @@ cont { color: 0xFFFFFF priority: 394 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10817 } } @@ -17924,9 +17924,9 @@ cont { color: 0xFFFFFF priority: 710 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11543 } } @@ -17937,9 +17937,9 @@ cont { color: 0xFFFFFF priority: 752 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11776 } } @@ -18715,9 +18715,9 @@ cont { color: 0xD0D0D0 priority: 288 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10610 } } @@ -18728,9 +18728,9 @@ cont { color: 0xD0D0D0 priority: 400 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10821 } } @@ -18741,9 +18741,9 @@ cont { color: 0xD0D0D0 priority: 711 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11547 } } @@ -18754,9 +18754,9 @@ cont { color: 0xD0D0D0 priority: 753 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11780 } } @@ -19439,9 +19439,9 @@ cont { color: 0xFDBF6F priority: 296 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10622 } } @@ -19452,9 +19452,9 @@ cont { color: 0xFDBF6F priority: 404 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 10889 } } @@ -19465,9 +19465,9 @@ cont { color: 0xFDBF6F priority: 719 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11549 } } @@ -19478,9 +19478,9 @@ cont { color: 0xFDBF6F priority: 761 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11782 } } @@ -20341,9 +20341,9 @@ cont { color: 0xFDBF6F priority: 295 } - caption { + path_text { height: 8 - stroke_color: 0x0 + color: 0x0 priority: 10613 } } @@ -20354,9 +20354,9 @@ cont { color: 0xFDBF6F priority: 403 } - caption { + path_text { height: 10 - stroke_color: 0x0 + color: 0x0 priority: 10824 } } @@ -20367,9 +20367,9 @@ cont { color: 0xFDBF6F priority: 718 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11455 } } @@ -20380,9 +20380,9 @@ cont { color: 0xFDBF6F priority: 760 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11733 } } @@ -21251,9 +21251,9 @@ cont { color: 0xFFFFFF priority: 707 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11541 } } @@ -21264,9 +21264,9 @@ cont { color: 0xFFFFFF priority: 749 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11774 } } @@ -22657,9 +22657,9 @@ cont { } priority: 685 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11527 } } @@ -22704,9 +22704,9 @@ cont { } priority: 726 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11760 } } @@ -23498,9 +23498,9 @@ cont { color: 0xFFFF90 priority: 402 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 10888 } } @@ -23511,9 +23511,9 @@ cont { color: 0xFFFF90 priority: 717 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11548 } } @@ -23524,9 +23524,9 @@ cont { color: 0xFFFF90 priority: 759 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11781 } } @@ -24393,9 +24393,9 @@ cont { color: 0xFFFF90 priority: 401 } - caption { + path_text { height: 10 - stroke_color: 0x0 + color: 0x0 priority: 10822 } } @@ -24406,9 +24406,9 @@ cont { color: 0xFFFF90 priority: 716 } - caption { + path_text { height: 10 - stroke_color: 0x0 + color: 0x0 priority: 11453 } } @@ -24419,9 +24419,9 @@ cont { color: 0xFFFF90 priority: 758 } - caption { + path_text { height: 10 - stroke_color: 0x0 + color: 0x0 priority: 11731 } } @@ -25285,9 +25285,9 @@ cont { color: 0xFFF2DE priority: 704 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11539 } } @@ -25298,9 +25298,9 @@ cont { color: 0xFFF2DE priority: 745 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11772 } } @@ -27513,9 +27513,9 @@ cont { color: 0x7FC97F priority: 301 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10624 } } @@ -27531,9 +27531,9 @@ cont { color: 0x7FC97F priority: 409 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 10891 } } @@ -27549,9 +27549,9 @@ cont { color: 0x7FC97F priority: 724 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11551 } } @@ -27572,9 +27572,9 @@ cont { color: 0x7FC97F priority: 766 } - caption { + path_text { height: 16 - stroke_color: 0x606060 + color: 0x606060 priority: 11784 } } @@ -28915,9 +28915,9 @@ cont { color: 0x7FC97F priority: 298 } - caption { + path_text { height: 8 - stroke_color: 0x0 + color: 0x0 priority: 10616 } } @@ -28933,9 +28933,9 @@ cont { color: 0x7FC97F priority: 406 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 10827 } } @@ -28951,9 +28951,9 @@ cont { color: 0x7FC97F priority: 721 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11458 } } @@ -28969,9 +28969,9 @@ cont { color: 0x7FC97F priority: 763 } - caption { + path_text { height: 12 - stroke_color: 0x0 + color: 0x0 priority: 11736 } } @@ -29917,9 +29917,9 @@ cont { color: 0xFFFFFF priority: 393 } - caption { + path_text { height: 9 - stroke_color: 0x0 + color: 0x0 priority: 10816 } } @@ -29930,9 +29930,9 @@ cont { color: 0xFFFFFF priority: 708 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11542 } } @@ -29943,9 +29943,9 @@ cont { color: 0xFFFFFF priority: 750 } - caption { + path_text { height: 12 - stroke_color: 0x606060 + color: 0x606060 priority: 11775 } } @@ -30745,9 +30745,9 @@ cont { color: 0xFFFFFF priority: 705 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11540 } } @@ -30758,9 +30758,9 @@ cont { color: 0xFFFFFF priority: 746 } - caption { + path_text { height: 10 - stroke_color: 0x606060 + color: 0x606060 priority: 11773 } } @@ -45572,9 +45572,9 @@ cont { } priority: 534 } - caption { + path_text { height: 7 - stroke_color: 0x0 + color: 0x0 priority: 537 } } @@ -45683,9 +45683,9 @@ cont { } priority: 535 } - caption { + path_text { height: 7 - stroke_color: 0x0 + color: 0x0 priority: 538 } } @@ -45806,9 +45806,9 @@ cont { } priority: 533 } - caption { + path_text { height: 7 - stroke_color: 0x0 + color: 0x0 priority: 536 } } @@ -55009,9 +55009,9 @@ cont { color: 0xB5D6F1 priority: 103 } - caption { + path_text { height: 6 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 10602 } } @@ -55027,9 +55027,9 @@ cont { color: 0xB5D6F1 priority: 108 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 10813 } } @@ -55045,9 +55045,9 @@ cont { color: 0xB5D6F1 priority: 110 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11429 } } @@ -55063,9 +55063,9 @@ cont { color: 0xB5D6F1 priority: 112 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11707 } } @@ -55246,9 +55246,9 @@ cont { color: 0xB5D6F1 priority: 112 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11419 } } @@ -55264,9 +55264,9 @@ cont { color: 0xB5D6F1 priority: 114 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11697 } } @@ -55599,9 +55599,9 @@ cont { color: 0xB5D6F1 priority: 111 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11421 } } @@ -55617,9 +55617,9 @@ cont { color: 0xB5D6F1 priority: 113 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11699 } } @@ -55865,9 +55865,9 @@ cont { color: 0xB5D6F1 priority: 99 } - caption { + path_text { height: 6 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 10604 } } @@ -55883,9 +55883,9 @@ cont { color: 0xB5D6F1 priority: 104 } - caption { + path_text { height: 6 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 10815 } } @@ -55901,9 +55901,9 @@ cont { color: 0xB5D6F1 priority: 106 } - caption { + path_text { height: 8 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11433 } } @@ -55919,9 +55919,9 @@ cont { color: 0xB5D6F1 priority: 108 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11711 } } @@ -56254,9 +56254,9 @@ cont { color: 0xB5D6F1 priority: 109 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11431 } } @@ -56272,9 +56272,9 @@ cont { color: 0xB5D6F1 priority: 111 } - caption { + path_text { height: 12 - stroke_color: 0xFFFFFF + color: 0xFFFFFF priority: 11709 } } diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index e40345cdb5..b7ff913e43 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -292,11 +292,7 @@ namespace { static const int visible[3][drule::count_of_rules] = { {0, 0, 1, 1, 1, 0, 0}, // fpoint - #ifdef USE_PROTO_STYLES - {1, 0, 0, 1, 0, 0, 0}, // fline - #else {1, 0, 0, 0, 0, 1, 0}, // fline - #endif {1, 1, 1, 1, 0, 0, 0} // farea }; @@ -416,11 +412,7 @@ bool ClassifObject::IsDrawableLike(FeatureGeoType ft) const static const int visible[3][drule::count_of_rules] = { {0, 0, 1, 1, 1, 0, 0}, // fpoint - #ifdef USE_PROTO_STYLES - {1, 0, 0, 1, 0, 0, 0}, // fline - #else {1, 0, 0, 0, 0, 1, 0}, // fline - #endif {0, 1, 0, 0, 0, 0, 0} // farea (!!! key difference with GetSuitable !!!) }; diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp index 49cc03ecb4..e1b15b2160 100644 --- a/indexer/drawing_rules.cpp +++ b/indexer/drawing_rules.cpp @@ -648,7 +648,7 @@ namespace drule { virtual void Write(FileWriterStream & ar) const { write_rules(ar, this); } virtual double GetTextHeight() const { return m_params.get<6>().m_v; } - virtual int GetColor() const {return m_params.get<7>().m_v;} + virtual int GetFillColor() const {return m_params.get<7>().m_v;} static string arrKeys[10]; }; @@ -1149,13 +1149,18 @@ namespace void ConvertImpl(BaseRule const * pSrc, CaptionRuleProto * pDest) const { pDest->set_height(ToPixels(pSrc->GetTextHeight())); + pDest->set_color(GetFillColor(pSrc)); - if (pSrc->GetFillColor() != -1) - pDest->set_color(GetFillColor(pSrc)); if (pSrc->GetColor() != -1) pDest->set_stroke_color(GetColor(pSrc)); } + void ConvertImpl(BaseRule const * pSrc, PathTextRuleProto * pDest) const + { + pDest->set_height(ToPixels(pSrc->GetTextHeight())); + pDest->set_color(GetFillColor(pSrc)); + } + void ConvertImpl(BaseRule const * pSrc, CircleRuleProto * pDest) const { pDest->set_radius(ToPixels(pSrc->GetRadius())); @@ -1228,12 +1233,13 @@ namespace Convert(pRule, keys[i].m_priority, pDE->mutable_symbol()); break; case caption: - case pathtext: Convert(pRule, keys[i].m_priority, pDE->mutable_caption()); break; case circle: Convert(pRule, keys[i].m_priority, pDE->mutable_circle()); break; + case pathtext: + Convert(pRule, keys[i].m_priority, pDE->mutable_path_text()); } } } @@ -1329,7 +1335,7 @@ namespace { return m_area.color(); } - virtual unsigned char GetAlpha () const + virtual unsigned char GetAlpha() const { return AlphaFromColor(GetFillColor()); } @@ -1382,7 +1388,7 @@ namespace { return m_caption.height(); } - virtual unsigned char GetAlpha () const + virtual unsigned char GetAlpha() const { return AlphaFromColor(GetFillColor()); } @@ -1403,6 +1409,26 @@ namespace return m_circle.radius(); } }; + + class PathText : public MyBase + { + PathTextRuleProto m_text; + public: + PathText(PathTextRuleProto const & r) : m_text(r) {} + + virtual int GetFillColor() const + { + return m_text.color(); + } + virtual double GetTextHeight() const + { + return m_text.height(); + } + virtual unsigned char GetAlpha() const + { + return AlphaFromColor(GetFillColor()); + } + }; } class DoSetIndex @@ -1511,6 +1537,9 @@ namespace if (de.has_circle()) AddRule(p, de.scale(), circle, de.circle()); + + if (de.has_path_text()) + AddRule(p, de.scale(), pathtext, de.path_text()); } } diff --git a/indexer/drawing_rules.hpp b/indexer/drawing_rules.hpp index 4c0d8add21..310c10e535 100644 --- a/indexer/drawing_rules.hpp +++ b/indexer/drawing_rules.hpp @@ -97,7 +97,7 @@ namespace drule virtual double GetTextHeight() const { return -1.0; } ///< text height of "caption" //@} - virtual unsigned char GetAlpha () const { return 255; } + virtual unsigned char GetAlpha() const { return 255; } virtual double GetWidth() const { return -1; } virtual void GetPattern(vector &, double &) const {} virtual void GetSymbol(string &) const {} diff --git a/indexer/drules_struct.pb.cc b/indexer/drules_struct.pb.cc index 4aaf4c9cfd..3891db1df1 100644 --- a/indexer/drules_struct.pb.cc +++ b/indexer/drules_struct.pb.cc @@ -33,6 +33,9 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* CircleRuleProto_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* CircleRuleProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* PathTextRuleProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + PathTextRuleProto_reflection_ = NULL; const ::google::protobuf::Descriptor* DrawElementProto_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* DrawElementProto_reflection_ = NULL; @@ -156,14 +159,32 @@ void protobuf_AssignDesc_drules_5fstruct_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(CircleRuleProto)); - DrawElementProto_descriptor_ = file->message_type(6); - static const int DrawElementProto_offsets_[6] = { + PathTextRuleProto_descriptor_ = file->message_type(6); + static const int PathTextRuleProto_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PathTextRuleProto, height_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PathTextRuleProto, color_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PathTextRuleProto, priority_), + }; + PathTextRuleProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + PathTextRuleProto_descriptor_, + PathTextRuleProto::default_instance_, + PathTextRuleProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PathTextRuleProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PathTextRuleProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(PathTextRuleProto)); + DrawElementProto_descriptor_ = file->message_type(7); + static const int DrawElementProto_offsets_[7] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, scale_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, lines_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, area_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, symbol_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, caption_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, circle_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrawElementProto, path_text_), }; DrawElementProto_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( @@ -176,7 +197,7 @@ void protobuf_AssignDesc_drules_5fstruct_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(DrawElementProto)); - ClassifElementProto_descriptor_ = file->message_type(7); + ClassifElementProto_descriptor_ = file->message_type(8); static const int ClassifElementProto_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ClassifElementProto, name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ClassifElementProto, element_), @@ -192,7 +213,7 @@ void protobuf_AssignDesc_drules_5fstruct_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(ClassifElementProto)); - ContainerProto_descriptor_ = file->message_type(8); + ContainerProto_descriptor_ = file->message_type(9); static const int ContainerProto_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ContainerProto, cont_), }; @@ -231,6 +252,8 @@ void protobuf_RegisterTypes(const ::std::string&) { CaptionRuleProto_descriptor_, &CaptionRuleProto::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( CircleRuleProto_descriptor_, &CircleRuleProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + PathTextRuleProto_descriptor_, &PathTextRuleProto::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( DrawElementProto_descriptor_, &DrawElementProto::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( @@ -254,6 +277,8 @@ void protobuf_ShutdownFile_drules_5fstruct_2eproto() { delete CaptionRuleProto_reflection_; delete CircleRuleProto::default_instance_; delete CircleRuleProto_reflection_; + delete PathTextRuleProto::default_instance_; + delete PathTextRuleProto_reflection_; delete DrawElementProto::default_instance_; delete DrawElementProto_reflection_; delete ClassifElementProto::default_instance_; @@ -278,18 +303,21 @@ void protobuf_AddDesc_drules_5fstruct_2eproto() { " \002(\005\"I\n\017SymbolRuleProto\022\014\n\004name\030\001 \002(\t\022\026\n" "\016apply_for_type\030\002 \001(\005\022\020\n\010priority\030\003 \002(\005\"" "Y\n\020CaptionRuleProto\022\016\n\006height\030\001 \002(\005\022\r\n\005c" - "olor\030\002 \001(\r\022\024\n\014stroke_color\030\003 \001(\r\022\020\n\010prio" + "olor\030\002 \002(\r\022\024\n\014stroke_color\030\003 \001(\r\022\020\n\010prio" "rity\030\004 \002(\005\"b\n\017CircleRuleProto\022\016\n\006radius\030" "\001 \002(\001\022\r\n\005color\030\002 \002(\r\022\036\n\006border\030\003 \001(\0132\016.L" - "ineRuleProto\022\020\n\010priority\030\004 \002(\005\"\306\001\n\020DrawE" - "lementProto\022\r\n\005scale\030\001 \002(\005\022\035\n\005lines\030\002 \003(" - "\0132\016.LineRuleProto\022\034\n\004area\030\003 \001(\0132\016.AreaRu" - "leProto\022 \n\006symbol\030\004 \001(\0132\020.SymbolRuleProt" - "o\022\"\n\007caption\030\005 \001(\0132\021.CaptionRuleProto\022 \n" - "\006circle\030\006 \001(\0132\020.CircleRuleProto\"G\n\023Class" - "ifElementProto\022\014\n\004name\030\001 \002(\t\022\"\n\007element\030" - "\002 \003(\0132\021.DrawElementProto\"4\n\016ContainerPro" - "to\022\"\n\004cont\030\001 \003(\0132\024.ClassifElementProto", 838); + "ineRuleProto\022\020\n\010priority\030\004 \002(\005\"D\n\021PathTe" + "xtRuleProto\022\016\n\006height\030\001 \002(\005\022\r\n\005color\030\002 \002" + "(\r\022\020\n\010priority\030\003 \002(\005\"\355\001\n\020DrawElementProt" + "o\022\r\n\005scale\030\001 \002(\005\022\035\n\005lines\030\002 \003(\0132\016.LineRu" + "leProto\022\034\n\004area\030\003 \001(\0132\016.AreaRuleProto\022 \n" + "\006symbol\030\004 \001(\0132\020.SymbolRuleProto\022\"\n\007capti" + "on\030\005 \001(\0132\021.CaptionRuleProto\022 \n\006circle\030\006 " + "\001(\0132\020.CircleRuleProto\022%\n\tpath_text\030\007 \001(\013" + "2\022.PathTextRuleProto\"G\n\023ClassifElementPr" + "oto\022\014\n\004name\030\001 \002(\t\022\"\n\007element\030\002 \003(\0132\021.Dra" + "wElementProto\"4\n\016ContainerProto\022\"\n\004cont\030" + "\001 \003(\0132\024.ClassifElementProto", 947); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "drules_struct.proto", &protobuf_RegisterTypes); DashDotProto::default_instance_ = new DashDotProto(); @@ -298,6 +326,7 @@ void protobuf_AddDesc_drules_5fstruct_2eproto() { SymbolRuleProto::default_instance_ = new SymbolRuleProto(); CaptionRuleProto::default_instance_ = new CaptionRuleProto(); CircleRuleProto::default_instance_ = new CircleRuleProto(); + PathTextRuleProto::default_instance_ = new PathTextRuleProto(); DrawElementProto::default_instance_ = new DrawElementProto(); ClassifElementProto::default_instance_ = new ClassifElementProto(); ContainerProto::default_instance_ = new ContainerProto(); @@ -307,6 +336,7 @@ void protobuf_AddDesc_drules_5fstruct_2eproto() { SymbolRuleProto::default_instance_->InitAsDefaultInstance(); CaptionRuleProto::default_instance_->InitAsDefaultInstance(); CircleRuleProto::default_instance_->InitAsDefaultInstance(); + PathTextRuleProto::default_instance_->InitAsDefaultInstance(); DrawElementProto::default_instance_->InitAsDefaultInstance(); ClassifElementProto::default_instance_->InitAsDefaultInstance(); ContainerProto::default_instance_->InitAsDefaultInstance(); @@ -1597,7 +1627,7 @@ bool CaptionRuleProto::MergePartialFromCodedStream( break; } - // optional uint32 color = 2; + // required uint32 color = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { @@ -1668,7 +1698,7 @@ void CaptionRuleProto::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->height(), output); } - // optional uint32 color = 2; + // required uint32 color = 2; if (has_color()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->color(), output); } @@ -1696,7 +1726,7 @@ void CaptionRuleProto::SerializeWithCachedSizes( target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->height(), target); } - // optional uint32 color = 2; + // required uint32 color = 2; if (has_color()) { target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->color(), target); } @@ -1729,7 +1759,7 @@ int CaptionRuleProto::ByteSize() const { this->height()); } - // optional uint32 color = 2; + // required uint32 color = 2; if (has_color()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( @@ -1806,7 +1836,7 @@ void CaptionRuleProto::CopyFrom(const CaptionRuleProto& from) { } bool CaptionRuleProto::IsInitialized() const { - if ((_has_bits_[0] & 0x00000009) != 0x00000009) return false; + if ((_has_bits_[0] & 0x0000000b) != 0x0000000b) return false; return true; } @@ -2166,6 +2196,294 @@ void CircleRuleProto::Swap(CircleRuleProto* other) { } +// =================================================================== + +#ifndef _MSC_VER +const int PathTextRuleProto::kHeightFieldNumber; +const int PathTextRuleProto::kColorFieldNumber; +const int PathTextRuleProto::kPriorityFieldNumber; +#endif // !_MSC_VER + +PathTextRuleProto::PathTextRuleProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void PathTextRuleProto::InitAsDefaultInstance() { +} + +PathTextRuleProto::PathTextRuleProto(const PathTextRuleProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void PathTextRuleProto::SharedCtor() { + _cached_size_ = 0; + height_ = 0; + color_ = 0u; + priority_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +PathTextRuleProto::~PathTextRuleProto() { + SharedDtor(); +} + +void PathTextRuleProto::SharedDtor() { + if (this != default_instance_) { + } +} + +void PathTextRuleProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* PathTextRuleProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PathTextRuleProto_descriptor_; +} + +const PathTextRuleProto& PathTextRuleProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_drules_5fstruct_2eproto(); return *default_instance_; +} + +PathTextRuleProto* PathTextRuleProto::default_instance_ = NULL; + +PathTextRuleProto* PathTextRuleProto::New() const { + return new PathTextRuleProto; +} + +void PathTextRuleProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + height_ = 0; + color_ = 0u; + priority_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool PathTextRuleProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required int32 height = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &height_))); + set_has_height(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_color; + break; + } + + // required uint32 color = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_color: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + input, &color_))); + set_has_color(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_priority; + break; + } + + // required int32 priority = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_priority: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &priority_))); + set_has_priority(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void PathTextRuleProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required int32 height = 1; + if (has_height()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->height(), output); + } + + // required uint32 color = 2; + if (has_color()) { + ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->color(), output); + } + + // required int32 priority = 3; + if (has_priority()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->priority(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* PathTextRuleProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // required int32 height = 1; + if (has_height()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->height(), target); + } + + // required uint32 color = 2; + if (has_color()) { + target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->color(), target); + } + + // required int32 priority = 3; + if (has_priority()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->priority(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int PathTextRuleProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required int32 height = 1; + if (has_height()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->height()); + } + + // required uint32 color = 2; + if (has_color()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::UInt32Size( + this->color()); + } + + // required int32 priority = 3; + if (has_priority()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->priority()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void PathTextRuleProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const PathTextRuleProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void PathTextRuleProto::MergeFrom(const PathTextRuleProto& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_height()) { + set_height(from.height()); + } + if (from.has_color()) { + set_color(from.color()); + } + if (from.has_priority()) { + set_priority(from.priority()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void PathTextRuleProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void PathTextRuleProto::CopyFrom(const PathTextRuleProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool PathTextRuleProto::IsInitialized() const { + if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false; + + return true; +} + +void PathTextRuleProto::Swap(PathTextRuleProto* other) { + if (other != this) { + std::swap(height_, other->height_); + std::swap(color_, other->color_); + std::swap(priority_, other->priority_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata PathTextRuleProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = PathTextRuleProto_descriptor_; + metadata.reflection = PathTextRuleProto_reflection_; + return metadata; +} + + // =================================================================== #ifndef _MSC_VER @@ -2175,6 +2493,7 @@ const int DrawElementProto::kAreaFieldNumber; const int DrawElementProto::kSymbolFieldNumber; const int DrawElementProto::kCaptionFieldNumber; const int DrawElementProto::kCircleFieldNumber; +const int DrawElementProto::kPathTextFieldNumber; #endif // !_MSC_VER DrawElementProto::DrawElementProto() @@ -2187,6 +2506,7 @@ void DrawElementProto::InitAsDefaultInstance() { symbol_ = const_cast< ::SymbolRuleProto*>(&::SymbolRuleProto::default_instance()); caption_ = const_cast< ::CaptionRuleProto*>(&::CaptionRuleProto::default_instance()); circle_ = const_cast< ::CircleRuleProto*>(&::CircleRuleProto::default_instance()); + path_text_ = const_cast< ::PathTextRuleProto*>(&::PathTextRuleProto::default_instance()); } DrawElementProto::DrawElementProto(const DrawElementProto& from) @@ -2202,6 +2522,7 @@ void DrawElementProto::SharedCtor() { symbol_ = NULL; caption_ = NULL; circle_ = NULL; + path_text_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -2215,6 +2536,7 @@ void DrawElementProto::SharedDtor() { delete symbol_; delete caption_; delete circle_; + delete path_text_; } } @@ -2253,6 +2575,9 @@ void DrawElementProto::Clear() { if (has_circle()) { if (circle_ != NULL) circle_->::CircleRuleProto::Clear(); } + if (has_path_text()) { + if (path_text_ != NULL) path_text_->::PathTextRuleProto::Clear(); + } } lines_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2347,6 +2672,20 @@ bool DrawElementProto::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } + if (input->ExpectTag(58)) goto parse_path_text; + break; + } + + // optional .PathTextRuleProto path_text = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_path_text: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_path_text())); + } else { + goto handle_uninterpreted; + } if (input->ExpectAtEnd()) return true; break; } @@ -2404,6 +2743,12 @@ void DrawElementProto::SerializeWithCachedSizes( 6, this->circle(), output); } + // optional .PathTextRuleProto path_text = 7; + if (has_path_text()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 7, this->path_text(), output); + } + if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); @@ -2452,6 +2797,13 @@ void DrawElementProto::SerializeWithCachedSizes( 6, this->circle(), target); } + // optional .PathTextRuleProto path_text = 7; + if (has_path_text()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 7, this->path_text(), target); + } + if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); @@ -2498,6 +2850,13 @@ int DrawElementProto::ByteSize() const { this->circle()); } + // optional .PathTextRuleProto path_text = 7; + if (has_path_text()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->path_text()); + } + } // repeated .LineRuleProto lines = 2; total_size += 1 * this->lines_size(); @@ -2549,6 +2908,9 @@ void DrawElementProto::MergeFrom(const DrawElementProto& from) { if (from.has_circle()) { mutable_circle()->::CircleRuleProto::MergeFrom(from.circle()); } + if (from.has_path_text()) { + mutable_path_text()->::PathTextRuleProto::MergeFrom(from.path_text()); + } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } @@ -2583,6 +2945,9 @@ bool DrawElementProto::IsInitialized() const { if (has_circle()) { if (!this->circle().IsInitialized()) return false; } + if (has_path_text()) { + if (!this->path_text().IsInitialized()) return false; + } return true; } @@ -2594,6 +2959,7 @@ void DrawElementProto::Swap(DrawElementProto* other) { std::swap(symbol_, other->symbol_); std::swap(caption_, other->caption_); std::swap(circle_, other->circle_); + std::swap(path_text_, other->path_text_); std::swap(_has_bits_[0], other->_has_bits_[0]); _unknown_fields_.Swap(&other->_unknown_fields_); std::swap(_cached_size_, other->_cached_size_); diff --git a/indexer/drules_struct.pb.h b/indexer/drules_struct.pb.h index 4a63714713..7bd03c2369 100644 --- a/indexer/drules_struct.pb.h +++ b/indexer/drules_struct.pb.h @@ -36,6 +36,7 @@ class AreaRuleProto; class SymbolRuleProto; class CaptionRuleProto; class CircleRuleProto; +class PathTextRuleProto; class DrawElementProto; class ClassifElementProto; class ContainerProto; @@ -520,7 +521,7 @@ class CaptionRuleProto : public ::google::protobuf::Message { inline ::google::protobuf::int32 height() const; inline void set_height(::google::protobuf::int32 value); - // optional uint32 color = 2; + // required uint32 color = 2; inline bool has_color() const; inline void clear_color(); static const int kColorFieldNumber = 2; @@ -684,6 +685,108 @@ class CircleRuleProto : public ::google::protobuf::Message { }; // ------------------------------------------------------------------- +class PathTextRuleProto : public ::google::protobuf::Message { + public: + PathTextRuleProto(); + virtual ~PathTextRuleProto(); + + PathTextRuleProto(const PathTextRuleProto& from); + + inline PathTextRuleProto& operator=(const PathTextRuleProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const PathTextRuleProto& default_instance(); + + void Swap(PathTextRuleProto* other); + + // implements Message ---------------------------------------------- + + PathTextRuleProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const PathTextRuleProto& from); + void MergeFrom(const PathTextRuleProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 height = 1; + inline bool has_height() const; + inline void clear_height(); + static const int kHeightFieldNumber = 1; + inline ::google::protobuf::int32 height() const; + inline void set_height(::google::protobuf::int32 value); + + // required uint32 color = 2; + inline bool has_color() const; + inline void clear_color(); + static const int kColorFieldNumber = 2; + inline ::google::protobuf::uint32 color() const; + inline void set_color(::google::protobuf::uint32 value); + + // required int32 priority = 3; + inline bool has_priority() const; + inline void clear_priority(); + static const int kPriorityFieldNumber = 3; + inline ::google::protobuf::int32 priority() const; + inline void set_priority(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:PathTextRuleProto) + private: + inline void set_has_height(); + inline void clear_has_height(); + inline void set_has_color(); + inline void clear_has_color(); + inline void set_has_priority(); + inline void clear_has_priority(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int32 height_; + ::google::protobuf::uint32 color_; + ::google::protobuf::int32 priority_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_drules_5fstruct_2eproto(); + friend void protobuf_AssignDesc_drules_5fstruct_2eproto(); + friend void protobuf_ShutdownFile_drules_5fstruct_2eproto(); + + void InitAsDefaultInstance(); + static PathTextRuleProto* default_instance_; +}; +// ------------------------------------------------------------------- + class DrawElementProto : public ::google::protobuf::Message { public: DrawElementProto(); @@ -789,6 +892,14 @@ class DrawElementProto : public ::google::protobuf::Message { inline ::CircleRuleProto* mutable_circle(); inline ::CircleRuleProto* release_circle(); + // optional .PathTextRuleProto path_text = 7; + inline bool has_path_text() const; + inline void clear_path_text(); + static const int kPathTextFieldNumber = 7; + inline const ::PathTextRuleProto& path_text() const; + inline ::PathTextRuleProto* mutable_path_text(); + inline ::PathTextRuleProto* release_path_text(); + // @@protoc_insertion_point(class_scope:DrawElementProto) private: inline void set_has_scale(); @@ -801,6 +912,8 @@ class DrawElementProto : public ::google::protobuf::Message { inline void clear_has_caption(); inline void set_has_circle(); inline void clear_has_circle(); + inline void set_has_path_text(); + inline void clear_has_path_text(); ::google::protobuf::UnknownFieldSet _unknown_fields_; @@ -809,10 +922,11 @@ class DrawElementProto : public ::google::protobuf::Message { ::SymbolRuleProto* symbol_; ::CaptionRuleProto* caption_; ::CircleRuleProto* circle_; + ::PathTextRuleProto* path_text_; ::google::protobuf::int32 scale_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; friend void protobuf_AddDesc_drules_5fstruct_2eproto(); friend void protobuf_AssignDesc_drules_5fstruct_2eproto(); @@ -1367,7 +1481,7 @@ inline void CaptionRuleProto::set_height(::google::protobuf::int32 value) { height_ = value; } -// optional uint32 color = 2; +// required uint32 color = 2; inline bool CaptionRuleProto::has_color() const { return (_has_bits_[0] & 0x00000002u) != 0; } @@ -1534,6 +1648,76 @@ inline void CircleRuleProto::set_priority(::google::protobuf::int32 value) { // ------------------------------------------------------------------- +// PathTextRuleProto + +// required int32 height = 1; +inline bool PathTextRuleProto::has_height() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void PathTextRuleProto::set_has_height() { + _has_bits_[0] |= 0x00000001u; +} +inline void PathTextRuleProto::clear_has_height() { + _has_bits_[0] &= ~0x00000001u; +} +inline void PathTextRuleProto::clear_height() { + height_ = 0; + clear_has_height(); +} +inline ::google::protobuf::int32 PathTextRuleProto::height() const { + return height_; +} +inline void PathTextRuleProto::set_height(::google::protobuf::int32 value) { + set_has_height(); + height_ = value; +} + +// required uint32 color = 2; +inline bool PathTextRuleProto::has_color() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void PathTextRuleProto::set_has_color() { + _has_bits_[0] |= 0x00000002u; +} +inline void PathTextRuleProto::clear_has_color() { + _has_bits_[0] &= ~0x00000002u; +} +inline void PathTextRuleProto::clear_color() { + color_ = 0u; + clear_has_color(); +} +inline ::google::protobuf::uint32 PathTextRuleProto::color() const { + return color_; +} +inline void PathTextRuleProto::set_color(::google::protobuf::uint32 value) { + set_has_color(); + color_ = value; +} + +// required int32 priority = 3; +inline bool PathTextRuleProto::has_priority() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void PathTextRuleProto::set_has_priority() { + _has_bits_[0] |= 0x00000004u; +} +inline void PathTextRuleProto::clear_has_priority() { + _has_bits_[0] &= ~0x00000004u; +} +inline void PathTextRuleProto::clear_priority() { + priority_ = 0; + clear_has_priority(); +} +inline ::google::protobuf::int32 PathTextRuleProto::priority() const { + return priority_; +} +inline void PathTextRuleProto::set_priority(::google::protobuf::int32 value) { + set_has_priority(); + priority_ = value; +} + +// ------------------------------------------------------------------- + // DrawElementProto // required int32 scale = 1; @@ -1699,6 +1883,35 @@ inline ::CircleRuleProto* DrawElementProto::release_circle() { return temp; } +// optional .PathTextRuleProto path_text = 7; +inline bool DrawElementProto::has_path_text() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void DrawElementProto::set_has_path_text() { + _has_bits_[0] |= 0x00000040u; +} +inline void DrawElementProto::clear_has_path_text() { + _has_bits_[0] &= ~0x00000040u; +} +inline void DrawElementProto::clear_path_text() { + if (path_text_ != NULL) path_text_->::PathTextRuleProto::Clear(); + clear_has_path_text(); +} +inline const ::PathTextRuleProto& DrawElementProto::path_text() const { + return path_text_ != NULL ? *path_text_ : *default_instance_->path_text_; +} +inline ::PathTextRuleProto* DrawElementProto::mutable_path_text() { + set_has_path_text(); + if (path_text_ == NULL) path_text_ = new ::PathTextRuleProto; + return path_text_; +} +inline ::PathTextRuleProto* DrawElementProto::release_path_text() { + clear_has_path_text(); + ::PathTextRuleProto* temp = path_text_; + path_text_ = NULL; + return temp; +} + // ------------------------------------------------------------------- // ClassifElementProto diff --git a/indexer/drules_struct.proto b/indexer/drules_struct.proto index 3b3670248b..aab10134ce 100644 --- a/indexer/drules_struct.proto +++ b/indexer/drules_struct.proto @@ -31,7 +31,7 @@ message SymbolRuleProto message CaptionRuleProto { required int32 height = 1; - optional uint32 color = 2; + required uint32 color = 2; optional uint32 stroke_color = 3; required int32 priority = 4; } @@ -44,7 +44,12 @@ message CircleRuleProto required int32 priority = 4; } -// PathTextRule is same as CaptionRule +message PathTextRuleProto +{ + required int32 height = 1; + required uint32 color = 2; + required int32 priority = 3; +} // WayMarkerRule not used yet @@ -59,6 +64,7 @@ message DrawElementProto optional SymbolRuleProto symbol = 4; optional CaptionRuleProto caption = 5; optional CircleRuleProto circle = 6; + optional PathTextRuleProto path_text = 7; } message ClassifElementProto diff --git a/map/drawer_yg.cpp b/map/drawer_yg.cpp index 54a59d7805..94e149b1ff 100644 --- a/map/drawer_yg.cpp +++ b/map/drawer_yg.cpp @@ -230,16 +230,24 @@ bool DrawerYG::filter_text_size(rule_ptr_t pRule) const return pRule->GetTextHeight() * m_scale <= min_text_height_filtered; } +namespace +{ + yg::Color GetTextColor(drule::BaseRule const * pRule) + { + int const color = pRule->GetFillColor(); + return (color == -1 ? yg::Color(0, 0, 0, 0) : yg::Color::fromXRGB(color, pRule->GetAlpha())); + } +} + void DrawerYG::drawText(m2::PointD const & pt, di::DrawInfo const * pInfo, rule_ptr_t pRule, yg::EPosition pos, int depth) { - int const color = pRule->GetFillColor(); - yg::Color textColor(color == -1 ? yg::Color(0, 0, 0, 0) : yg::Color::fromXRGB(color, pRule->GetAlpha())); + yg::Color textColor = GetTextColor(pRule); /// to prevent white text on white outline if (textColor == yg::Color(255, 255, 255, 255)) textColor = yg::Color(0, 0, 0, 0); -// bool isMasked = pRule->GetColor() != -1; + //bool isMasked = pRule->GetColor() != -1; bool isMasked = true; yg::FontDesc fontDesc(get_text_font_size(pRule), textColor, isMasked, yg::Color(255, 255, 255, 255)); fontDesc.SetRank(pInfo->m_rank); @@ -255,11 +263,9 @@ void DrawerYG::drawText(m2::PointD const & pt, di::DrawInfo const * pInfo, rule_ true); } -bool DrawerYG::drawPathText(di::PathInfo const & info, string const & name, uint8_t fontSize, int depth) +bool DrawerYG::drawPathText(di::PathInfo const & info, string const & name, rule_ptr_t pRule, int depth) { -// bool const isMasked = (double(fontSize) / m_visualScale >= min_text_height); - - yg::FontDesc fontDesc(fontSize); + yg::FontDesc fontDesc(get_pathtext_font_size(pRule), GetTextColor(pRule)); return m_pScreen->drawPathText( fontDesc, &info.m_path[0], @@ -416,7 +422,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size if (filter_text_size(pRule)) continue; - drawPathText(*i, pInfo->m_name, get_pathtext_font_size(pRule), depth); + drawPathText(*i, pInfo->m_name, pRule, depth); } } diff --git a/map/drawer_yg.hpp b/map/drawer_yg.hpp index 9c44099bd7..3220c11e3c 100644 --- a/map/drawer_yg.hpp +++ b/map/drawer_yg.hpp @@ -80,7 +80,7 @@ protected: void drawArea(vector const & pts, rule_ptr_t pRule, int depth); void drawText(m2::PointD const & pt, di::DrawInfo const * pInfo, rule_ptr_t pRule, yg::EPosition pos, int depth); - bool drawPathText(di::PathInfo const & info, string const & name, uint8_t fontSize, int depth); + bool drawPathText(di::PathInfo const & info, string const & name, rule_ptr_t pRule, int depth); void drawPathNumber(di::PathInfo const & path, di::DrawInfo const * pInfo); typedef shared_ptr texture_t;