[mapguide-commits] r10024 - in sandbox/jng/basic_label_justification: Common/MdfModel Common/MdfParser Common/Schema Common/Stylization Server/src/UnitTesting UnitTest/TestData/Symbology

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Feb 4 05:50:49 PST 2023


Author: jng
Date: 2023-02-04 05:50:48 -0800 (Sat, 04 Feb 2023)
New Revision: 10024

Added:
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.ldf
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.mdf
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.ldf
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.mdf
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.ldf
   sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.mdf
Modified:
   sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.cpp
   sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.h
   sandbox/jng/basic_label_justification/Common/MdfParser/IOLabel.cpp
   sandbox/jng/basic_label_justification/Common/Schema/LayerDefinition-4.0.0.xsd
   sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.cpp
   sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.h
   sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestRenderingService.cpp
   sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestServiceFactory.cpp
Log:
#772: Add basic stylization support for justification of labels. This support already existed in the rendering/stylization engine. The justification setting simply never surfaced to any supported element in the current Layer Definition XML schema, so it always defaulted to left justification. This setting will be most impactful when dealing with multi-line feature labels where such a setting becomes important.

New rendering service tests have been added to exercise the various label justification settings. Manually inspecting the rendered results verifies the new justification setting is being respected.

Since we're here, we are also cleaning up the current v4.0.0 schema by making the previously introduced IncludeBoundsForSelectedFeatures element optional.

Modified: sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.cpp
===================================================================
--- sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.cpp	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.cpp	2023-02-04 13:50:48 UTC (rev 10024)
@@ -44,6 +44,7 @@
     this->m_strBold = L"false"; // NOXLATE
     this->m_strItalic = L"false"; // NOXLATE
     this->m_strUnderlined = L"false"; // NOXLATE
+    this->m_strLabelJustification = L"'Left'"; //NOXLATE
 #ifdef MG_ZERO_SCALELIMIT
     this->m_dScaleLimit = 0.0;
 #else
@@ -245,6 +246,33 @@
 }
 
 //-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the LabelJustification property in this
+//          TextSymbol. LabelJustification is of type Expression:String,
+//          which is an expression that evaluates to the text representation
+//          of a member of the enum RS_Justify.
+// RETURNS: The string representation of the Expression:String. Default is
+//          "Left".
+//-------------------------------------------------------------------------
+const MdfString& TextSymbol::GetLabelJustification() const
+{
+    return this->m_strLabelJustification;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the LabelJustification property in this
+//          TextSymbol. LabelJustification is of type Expression:String,
+//          which is an expression that evaluates to the text representation
+//          of a member of the enum RS_Justify.
+// PARAMETERS:
+//          strLabelJustification - The string representation of the
+//                              Expression:String.
+//-------------------------------------------------------------------------
+void TextSymbol::SetLabelJustification(const MdfString& strLabelJustification)
+{
+    this->m_strLabelJustification = strLabelJustification;
+}
+
+//-------------------------------------------------------------------------
 // PURPOSE: Accessor method for the Bold property in this TextSymbol.
 //          The property is of type Expression:Boolean, which is an
 //          expression that evaluates to a bool for a given feature.

Modified: sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.h
===================================================================
--- sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.h	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/MdfModel/TextSymbol.h	2023-02-04 13:50:48 UTC (rev 10024)
@@ -94,6 +94,10 @@
         const MdfString& GetVerticalAlignment() const;
         void SetVerticalAlignment(const MdfString& strVrtAlignment);
 
+        // Property : LabelJustification
+        const MdfString& GetLabelJustification() const;
+        void SetLabelJustification(const MdfString& strLabelJustification);
+
         // Property : Bold  Type : Expression:Boolean
         const MdfString& GetBold() const;
         void SetBold(const MdfString& strBoldExpr);
@@ -144,6 +148,9 @@
         // The Expression:enum string representation for the vertical orientation.
         MdfString m_strVrtAlignment;
 
+        // The Expression:enum string representation for the label justification.
+        MdfString m_strLabelJustification;
+
         // The Expression:Boolean string representation for Bold style.
         MdfString m_strBold;
 

Modified: sandbox/jng/basic_label_justification/Common/MdfParser/IOLabel.cpp
===================================================================
--- sandbox/jng/basic_label_justification/Common/MdfParser/IOLabel.cpp	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/MdfParser/IOLabel.cpp	2023-02-04 13:50:48 UTC (rev 10024)
@@ -48,7 +48,8 @@
 ELEM_MAP_ENTRY(19, Underlined);
 ELEM_MAP_ENTRY(20, AdvancedPlacement);
 ELEM_MAP_ENTRY(21, ScaleLimit);
-ELEM_MAP_ENTRY(22, ExtendedData1);
+ELEM_MAP_ENTRY(22, LabelJustification);
+ELEM_MAP_ENTRY(23, ExtendedData1);
 
 
 IOLabel::IOLabel(Version& version) : SAX2ElementHandler(version)
@@ -167,6 +168,10 @@
             symbol->SetVerticalAlignment(ch);
         break;
 
+    case eLabelJustification:
+        symbol->SetLabelJustification(ch);
+        break;
+
     case eBold:
         symbol->SetBold(ch);
         break;
@@ -298,6 +303,14 @@
             fd << endStr(sVerticalAlignment) << std::endl;
         }
 
+        // Property: LabelJustification
+        if (symbol->GetLabelJustification() != L"'Left'") // NOXLATE
+        {
+            fd << tab.tab() << startStr(sLabelJustification);
+            fd << EncodeString(symbol->GetLabelJustification());
+            fd << endStr(sLabelJustification) << std::endl;
+        }
+
         // Property: Bold
         if (wstrToBool(symbol->GetBold().c_str()))
         {

Modified: sandbox/jng/basic_label_justification/Common/Schema/LayerDefinition-4.0.0.xsd
===================================================================
--- sandbox/jng/basic_label_justification/Common/Schema/LayerDefinition-4.0.0.xsd	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/Schema/LayerDefinition-4.0.0.xsd	2023-02-04 13:50:48 UTC (rev 10024)
@@ -124,7 +124,7 @@
               <xs:documentation>A boolean FDO expression that specifies which features to return.  No filter means pass all features through.</xs:documentation>
             </xs:annotation>
           </xs:element>
-          <xs:element name="IncludeBoundsForSelectedFeatures" type="xs:boolean" default="true">
+          <xs:element name="IncludeBoundsForSelectedFeatures" type="xs:boolean" default="true" minOccurs="0">
             <xs:annotation>
               <xs:documentation>Controls whether bounding box data is included with selected features when selecting from this layer</xs:documentation>
             </xs:annotation>
@@ -601,6 +601,11 @@
               </xs:sequence>
             </xs:complexType>
           </xs:element>
+          <xs:element name="LabelJustification" type="xs:string" default="'Left'" minOccurs="0">
+            <xs:annotation>
+              <xs:documentation>A string FDO expression for the label justification.  Must evaluate to one of the 'Left', 'Right', ''.</xs:documentation>
+            </xs:annotation>
+          </xs:element>
           <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
         </xs:sequence>
       </xs:extension>

Modified: sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.cpp
===================================================================
--- sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.cpp	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.cpp	2023-02-04 13:50:48 UTC (rev 10024)
@@ -486,6 +486,58 @@
 
 
 //////////////////////////////////////////////////////////////////////////////
+bool GeometryAdapter::ConvertLabelJustification(const MdfModel::MdfString& justify, RS_Justify& rsjustify)
+{
+    // first check if the expression is a constant - in that case it can be cached
+    if (justify == L"'Center'")
+    {
+        rsjustify = RS_Justify_Center;
+        return true;
+    }
+    else if (justify == L"'Justify'")
+    {
+        rsjustify = RS_Justify_Justify;
+        return true;
+    }
+    else if (justify == L"'Left'")
+    {
+        rsjustify = RS_Justify_Left;
+        return true;
+    }
+    else if (justify == L"'Right'")
+    {
+        rsjustify = RS_Justify_Right;
+        return true;
+    }
+
+    // Otherwise we need to evaluate as expression.  If it is an expression,
+    // the value will come back without quotes.
+    RS_String str;
+    /*bool dummy =*/ EvalString(justify, str);
+
+    if (str == L"'Center'")
+    {
+        rsjustify = RS_Justify_Center;
+    }
+    else if (str == L"'Justify'")
+    {
+        rsjustify = RS_Justify_Justify;
+    }
+    else if (str == L"'Left'")
+    {
+        rsjustify = RS_Justify_Left;
+    }
+    else if (str == L"'Right'")
+    {
+        rsjustify = RS_Justify_Right;
+    }
+
+    // not cacheable
+    return false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
 bool GeometryAdapter::ConvertSymbol(MdfModel::Symbol* symbol, RS_MarkerDef& mdef)
 {
     SymbolVisitor::eSymbolType type = SymbolVisitor::DetermineSymbolType(symbol);
@@ -671,6 +723,9 @@
     cacheable = ConvertTextHAlign(text->GetHorizontalAlignment(), tdef.halign()) && cacheable;
     cacheable = ConvertTextVAlign(text->GetVerticalAlignment(), tdef.valign()) && cacheable;
 
+    // justification
+    cacheable = ConvertLabelJustification(text->GetLabelJustification(), tdef.justify()) && cacheable;
+
     return cacheable;
 }
 

Modified: sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.h
===================================================================
--- sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.h	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Common/Stylization/GeometryAdapter.h	2023-02-04 13:50:48 UTC (rev 10024)
@@ -54,6 +54,7 @@
     STYLIZATION_API bool ConvertFill      (MdfModel::AreaSymbolization2D* fill, RS_FillStyle&  rsfill);
     STYLIZATION_API bool ConvertTextHAlign(const MdfModel::MdfString&   halign, RS_HAlignment& rshalign);
     STYLIZATION_API bool ConvertTextVAlign(const MdfModel::MdfString&   valign, RS_VAlignment& rsvalign);
+    STYLIZATION_API bool ConvertLabelJustification(const MdfModel::MdfString& justify, RS_Justify& rsjustify);
     STYLIZATION_API bool ConvertSymbol    (MdfModel::Symbol*            symbol, RS_MarkerDef&  mdef);
     STYLIZATION_API bool ConvertTextDef   (MdfModel::TextSymbol*          text, RS_TextDef&    tdef);
 

Modified: sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestRenderingService.cpp	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestRenderingService.cpp	2023-02-04 13:50:48 UTC (rev 10024)
@@ -114,6 +114,28 @@
     return map;
 }
 
+static MgMap* CreateLabelJustifyMap(CREFSTRING justify)
+{
+    Ptr<MgServerSiteService> svcSite = TestServiceFactory::CreateSiteService();
+    Ptr<MgSiteConnection> m_siteConnection = TestServiceFactory::CreateSiteConnection(svcSite);
+
+    STRING sMdfId = L"Library://UnitTests/Maps/LabelJustify" + justify + L".MapDefinition";
+
+    Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(sMdfId);
+    MgMap* map = new MgMap(m_siteConnection);
+    map->Create(mdfres, mdfres->GetName());
+
+    Ptr<MgCoordinate> coordNewCenter = new MgCoordinateXY(-87.733253, 43.746199);
+    Ptr<MgPoint> ptNewCenter = new MgPoint(coordNewCenter);
+    map->SetViewCenter(ptNewCenter);
+    map->SetViewScale(75000.0);
+    map->SetDisplayDpi(96);
+    map->SetDisplayWidth(1024);
+    map->SetDisplayHeight(1024);
+
+    return map;
+}
+
 static MgMap* CreateTestTiledMap()
 {
     Ptr<MgServerSiteService> svcSite = TestServiceFactory::CreateSiteService();
@@ -1229,6 +1251,60 @@
     }
 }
 
+static void TestCase_LabelJustifyLeft(CREFSTRING imageFormat, CREFSTRING extension)
+{
+    try
+    {
+        Ptr<MgRenderingService> svcRendering = TestServiceFactory::CreateRenderingService();
+        Ptr<MgMap> map = CreateLabelJustifyMap(L"Left");
+        Ptr<MgByteReader> image = svcRendering->RenderMap(map, nullptr, imageFormat);
+
+        image->ToFile(GetPath(L"../UnitTestFiles/LabelJustifyLeft", imageFormat, extension));
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+        SAFE_RELEASE(e);
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+}
+
+static void TestCase_LabelJustifyRight(CREFSTRING imageFormat, CREFSTRING extension)
+{
+    try
+    {
+        Ptr<MgRenderingService> svcRendering = TestServiceFactory::CreateRenderingService();
+        Ptr<MgMap> map = CreateLabelJustifyMap(L"Right");
+        Ptr<MgByteReader> image = svcRendering->RenderMap(map, nullptr, imageFormat);
+
+        image->ToFile(GetPath(L"../UnitTestFiles/LabelJustifyRight", imageFormat, extension));
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+        SAFE_RELEASE(e);
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+}
+
+static void TestCase_LabelJustifyCenter(CREFSTRING imageFormat, CREFSTRING extension)
+{
+    try
+    {
+        Ptr<MgRenderingService> svcRendering = TestServiceFactory::CreateRenderingService();
+        Ptr<MgMap> map = CreateLabelJustifyMap(L"Center");
+        Ptr<MgByteReader> image = svcRendering->RenderMap(map, nullptr, imageFormat);
+
+        image->ToFile(GetPath(L"../UnitTestFiles/LabelJustifyCenter", imageFormat, extension));
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+        SAFE_RELEASE(e);
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+}
+
 static void TestCase_RenderMetatile(CREFSTRING imageFormat, CREFSTRING extension)
 {
     try
@@ -1665,6 +1741,21 @@
 TEST_CASE("RenderXYZMetatileJPG_4x", "[RenderingService]") { TestCase_RenderXYZMetatile(L"JPG", L"jpg", 4); }
 TEST_CASE("RenderXYZMetatileGIF_4x", "[RenderingService]") { TestCase_RenderXYZMetatile(L"GIF", L"gif", 4); }
 
+TEST_CASE("RenderLabelJustifyLeftPNG", "[RenderingService]") { TestCase_LabelJustifyLeft(L"PNG", L"png"); }
+TEST_CASE("RenderLabelJustifyLeftPNG8", "[RenderingService]") { TestCase_LabelJustifyLeft(L"PNG8", L"png"); }
+TEST_CASE("RenderLabelJustifyLeftJPG", "[RenderingService]") { TestCase_LabelJustifyLeft(L"JPG", L"jpg"); }
+TEST_CASE("RenderLabelJustifyLeftGIF", "[RenderingService]") { TestCase_LabelJustifyLeft(L"GIF", L"gif"); }
+
+TEST_CASE("RenderLabelJustifyRightPNG", "[RenderingService]") { TestCase_LabelJustifyRight(L"PNG", L"png"); }
+TEST_CASE("RenderLabelJustifyRightPNG8", "[RenderingService]") { TestCase_LabelJustifyRight(L"PNG8", L"png"); }
+TEST_CASE("RenderLabelJustifyRightJPG", "[RenderingService]") { TestCase_LabelJustifyRight(L"JPG", L"jpg"); }
+TEST_CASE("RenderLabelJustifyRightGIF", "[RenderingService]") { TestCase_LabelJustifyRight(L"GIF", L"gif"); }
+
+TEST_CASE("RenderLabelJustifyCenterPNG", "[RenderingService]") { TestCase_LabelJustifyCenter(L"PNG", L"png"); }
+TEST_CASE("RenderLabelJustifyCenterPNG8", "[RenderingService]") { TestCase_LabelJustifyCenter(L"PNG8", L"png"); }
+TEST_CASE("RenderLabelJustifyCenterJPG", "[RenderingService]") { TestCase_LabelJustifyCenter(L"JPG", L"jpg"); }
+TEST_CASE("RenderLabelJustifyCenterGIF", "[RenderingService]") { TestCase_LabelJustifyCenter(L"GIF", L"gif"); }
+
 TEST_CASE("RenderMapBigPNG", "[RenderingService_Stress]")
 {
     try

Modified: sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestServiceFactory.cpp
===================================================================
--- sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestServiceFactory.cpp	2023-02-04 12:10:15 UTC (rev 10023)
+++ sandbox/jng/basic_label_justification/Server/src/UnitTesting/TestServiceFactory.cpp	2023-02-04 13:50:48 UTC (rev 10024)
@@ -654,6 +654,21 @@
                 Ptr<MgByteReader> mdfrdr1 = mdfsrc1->GetReader();
                 svcResource->SetResource(mapres1, mdfrdr1, nullptr);
 
+                Ptr<MgResourceIdentifier> mapres22 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyLeft.MapDefinition");
+                Ptr<MgByteSource> mdfsrc22 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyLeft.mdf", false);
+                Ptr<MgByteReader> mdfrdr22 = mdfsrc22->GetReader();
+                svcResource->SetResource(mapres22, mdfrdr22, nullptr);
+
+                Ptr<MgResourceIdentifier> mapres23 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyRight.MapDefinition");
+                Ptr<MgByteSource> mdfsrc23 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyRight.mdf", false);
+                Ptr<MgByteReader> mdfrdr23 = mdfsrc23->GetReader();
+                svcResource->SetResource(mapres23, mdfrdr23, nullptr);
+
+                Ptr<MgResourceIdentifier> mapres24 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyCenter.MapDefinition");
+                Ptr<MgByteSource> mdfsrc24 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyCenter.mdf", false);
+                Ptr<MgByteReader> mdfrdr24 = mdfsrc24->GetReader();
+                svcResource->SetResource(mapres24, mdfrdr24, nullptr);
+
                 // publish tile set
                 Ptr<MgResourceIdentifier> tilesetres1 = new MgResourceIdentifier(L"Library://UnitTests/TileSets/XYZ.TileSetDefinition");
                 Ptr<MgByteSource> tsdsrc1 = new MgByteSource(L"../UnitTestFiles/UT_XYZ.tsd", false);
@@ -676,6 +691,21 @@
                 Ptr<MgByteReader> ldfrdr3 = ldfsrc3->GetReader();
                 svcResource->SetResource(ldfres3, ldfrdr3, nullptr);
 
+                Ptr<MgResourceIdentifier> ldfres24 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyLeft.LayerDefinition");
+                Ptr<MgByteSource> ldfsrc24 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyLeft.ldf", false);
+                Ptr<MgByteReader> ldfrdr24 = ldfsrc24->GetReader();
+                svcResource->SetResource(ldfres24, ldfrdr24, nullptr);
+
+                Ptr<MgResourceIdentifier> ldfres25 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyRight.LayerDefinition");
+                Ptr<MgByteSource> ldfsrc25 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyRight.ldf", false);
+                Ptr<MgByteReader> ldfrdr25 = ldfsrc25->GetReader();
+                svcResource->SetResource(ldfres25, ldfrdr25, nullptr);
+
+                Ptr<MgResourceIdentifier> ldfres26 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyCenter.LayerDefinition");
+                Ptr<MgByteSource> ldfsrc26 = new MgByteSource(L"../UnitTestFiles/UT_LabelJustifyCenter.ldf", false);
+                Ptr<MgByteReader> ldfrdr26 = ldfsrc26->GetReader();
+                svcResource->SetResource(ldfres26, ldfrdr26, nullptr);
+
                 // publish the feature sources
                 Ptr<MgResourceIdentifier> fsres1 = new MgResourceIdentifier(L"Library://UnitTests/Data/HydrographicPolygons.FeatureSource");
                 Ptr<MgByteSource> fssrc1 = new MgByteSource(L"../UnitTestFiles/UT_HydrographicPolygons.fs", false);
@@ -1936,6 +1966,15 @@
             Ptr<MgResourceIdentifier> mapres1 = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan.MapDefinition");
             svcResource->DeleteResource(mapres1);
 
+            Ptr<MgResourceIdentifier> mapres22 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyLeft.MapDefinition");
+            svcResource->DeleteResource(mapres22);
+
+            Ptr<MgResourceIdentifier> mapres23 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyRight.MapDefinition");
+            svcResource->DeleteResource(mapres23);
+
+            Ptr<MgResourceIdentifier> mapres24 = new MgResourceIdentifier(L"Library://UnitTests/Maps/LabelJustifyCenter.MapDefinition");
+            svcResource->DeleteResource(mapres24);
+
             // delete tile set
             Ptr<MgResourceIdentifier> tilesetres1 = new MgResourceIdentifier(L"Library://UnitTests/TileSets/XYZ.TileSetDefinition");
             svcResource->DeleteResource(tilesetres1);
@@ -1950,6 +1989,15 @@
             Ptr<MgResourceIdentifier> ldfres3 = new MgResourceIdentifier(L"Library://UnitTests/Layers/Parcels.LayerDefinition");
             svcResource->DeleteResource(ldfres3);
 
+            Ptr<MgResourceIdentifier> ldfres24 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyLeft.LayerDefinition");
+            svcResource->DeleteResource(ldfres24);
+
+            Ptr<MgResourceIdentifier> ldfres25 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyRight.LayerDefinition");
+            svcResource->DeleteResource(ldfres25);
+
+            Ptr<MgResourceIdentifier> ldfres26 = new MgResourceIdentifier(L"Library://UnitTests/Layers/LabelJustifyCenter.LayerDefinition");
+            svcResource->DeleteResource(ldfres26);
+
             // delete the feature sources
             Ptr<MgResourceIdentifier> fsres1 = new MgResourceIdentifier(L"Library://UnitTests/Data/HydrographicPolygons.FeatureSource");
             svcResource->DeleteResource(fsres1);

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.ldf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.ldf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.ldf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="4.0.0" xsi:noNamespaceSchemaLocation="LayerDefinition-4.0.0.xsd">
+  <VectorLayerDefinition>
+    <ResourceId>Library://UnitTests/Data/VotingDistricts.FeatureSource</ResourceId>
+    <FeatureName>Default:VotingDistricts</FeatureName>
+    <FeatureNameType>FeatureClass</FeatureNameType>
+    <Geometry>Geometry</Geometry>
+    <VectorScaleRange>
+      <MinScale>10000</MinScale>
+      <AreaTypeStyle>
+        <AreaRule>
+          <LegendLabel />
+          <Label>
+            <Unit>Points</Unit>
+            <SizeContext>DeviceUnits</SizeContext>
+            <SizeX>0</SizeX>
+            <SizeY>10</SizeY>
+            <Text>concat('District\n', ID)</Text>
+            <FontName>Verdana</FontName>
+            <ForegroundColor>FF625231</ForegroundColor>
+            <BackgroundColor>FFFFFFFF</BackgroundColor>
+            <BackgroundStyle>Transparent</BackgroundStyle>
+            <LabelJustification>'Center'</LabelJustification>
+          </Label>
+          <AreaSymbolization2D>
+            <Fill>
+              <FillPattern>None</FillPattern>
+              <ForegroundColor>00FFFFFF</ForegroundColor>
+              <BackgroundColor>FF000000</BackgroundColor>
+            </Fill>
+            <Stroke>
+              <LineStyle>Solid</LineStyle>
+              <Thickness>0</Thickness>
+              <Color>FFA68B53</Color>
+              <Unit>Inches</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+            </Stroke>
+          </AreaSymbolization2D>
+        </AreaRule>
+      </AreaTypeStyle>
+    </VectorScaleRange>
+  </VectorLayerDefinition>
+</LayerDefinition>
\ No newline at end of file

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.mdf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.mdf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyCenter.mdf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+  <Name>New Map</Name>
+  <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+  <Extents>
+    <MinX>-87.76498623679663</MinX>
+    <MaxX>-87.69551753753811</MaxX>
+    <MinY>43.691398447253356</MinY>
+    <MaxY>43.7975198255836</MaxY>
+  </Extents>
+  <BackgroundColor>ffffffff</BackgroundColor>
+  <MapLayer>
+    <Name>Districts</Name>
+    <ResourceId>Library://UnitTests/Layers/LabelJustifyCenter.LayerDefinition</ResourceId>
+    <Selectable>true</Selectable>
+    <ShowInLegend>true</ShowInLegend>
+    <LegendLabel>Districts</LegendLabel>
+    <ExpandInLegend>true</ExpandInLegend>
+    <Visible>true</Visible>
+    <Group />
+  </MapLayer>
+</MapDefinition>
\ No newline at end of file

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.ldf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.ldf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.ldf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="4.0.0" xsi:noNamespaceSchemaLocation="LayerDefinition-4.0.0.xsd">
+  <VectorLayerDefinition>
+    <ResourceId>Library://UnitTests/Data/VotingDistricts.FeatureSource</ResourceId>
+    <FeatureName>Default:VotingDistricts</FeatureName>
+    <FeatureNameType>FeatureClass</FeatureNameType>
+    <Geometry>Geometry</Geometry>
+    <VectorScaleRange>
+      <MinScale>10000</MinScale>
+      <AreaTypeStyle>
+        <AreaRule>
+          <LegendLabel />
+          <Label>
+            <Unit>Points</Unit>
+            <SizeContext>DeviceUnits</SizeContext>
+            <SizeX>0</SizeX>
+            <SizeY>10</SizeY>
+            <Text>concat('District\n', ID)</Text>
+            <FontName>Verdana</FontName>
+            <ForegroundColor>FF625231</ForegroundColor>
+            <BackgroundColor>FFFFFFFF</BackgroundColor>
+            <BackgroundStyle>Transparent</BackgroundStyle>
+            <LabelJustification>'Left'</LabelJustification>
+          </Label>
+          <AreaSymbolization2D>
+            <Fill>
+              <FillPattern>None</FillPattern>
+              <ForegroundColor>00FFFFFF</ForegroundColor>
+              <BackgroundColor>FF000000</BackgroundColor>
+            </Fill>
+            <Stroke>
+              <LineStyle>Solid</LineStyle>
+              <Thickness>0</Thickness>
+              <Color>FFA68B53</Color>
+              <Unit>Inches</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+            </Stroke>
+          </AreaSymbolization2D>
+        </AreaRule>
+      </AreaTypeStyle>
+    </VectorScaleRange>
+  </VectorLayerDefinition>
+</LayerDefinition>
\ No newline at end of file

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.mdf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.mdf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyLeft.mdf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+  <Name>New Map</Name>
+  <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+  <Extents>
+    <MinX>-87.76498623679663</MinX>
+    <MaxX>-87.69551753753811</MaxX>
+    <MinY>43.691398447253356</MinY>
+    <MaxY>43.7975198255836</MaxY>
+  </Extents>
+  <BackgroundColor>ffffffff</BackgroundColor>
+  <MapLayer>
+    <Name>Districts</Name>
+    <ResourceId>Library://UnitTests/Layers/LabelJustifyLeft.LayerDefinition</ResourceId>
+    <Selectable>true</Selectable>
+    <ShowInLegend>true</ShowInLegend>
+    <LegendLabel>Districts</LegendLabel>
+    <ExpandInLegend>true</ExpandInLegend>
+    <Visible>true</Visible>
+    <Group />
+  </MapLayer>
+</MapDefinition>
\ No newline at end of file

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.ldf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.ldf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.ldf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="4.0.0" xsi:noNamespaceSchemaLocation="LayerDefinition-4.0.0.xsd">
+  <VectorLayerDefinition>
+    <ResourceId>Library://UnitTests/Data/VotingDistricts.FeatureSource</ResourceId>
+    <FeatureName>Default:VotingDistricts</FeatureName>
+    <FeatureNameType>FeatureClass</FeatureNameType>
+    <Geometry>Geometry</Geometry>
+    <VectorScaleRange>
+      <MinScale>10000</MinScale>
+      <AreaTypeStyle>
+        <AreaRule>
+          <LegendLabel />
+          <Label>
+            <Unit>Points</Unit>
+            <SizeContext>DeviceUnits</SizeContext>
+            <SizeX>0</SizeX>
+            <SizeY>10</SizeY>
+            <Text>concat('District\n', ID)</Text>
+            <FontName>Verdana</FontName>
+            <ForegroundColor>FF625231</ForegroundColor>
+            <BackgroundColor>FFFFFFFF</BackgroundColor>
+            <BackgroundStyle>Transparent</BackgroundStyle>
+            <LabelJustification>'Right'</LabelJustification>
+          </Label>
+          <AreaSymbolization2D>
+            <Fill>
+              <FillPattern>None</FillPattern>
+              <ForegroundColor>00FFFFFF</ForegroundColor>
+              <BackgroundColor>FF000000</BackgroundColor>
+            </Fill>
+            <Stroke>
+              <LineStyle>Solid</LineStyle>
+              <Thickness>0</Thickness>
+              <Color>FFA68B53</Color>
+              <Unit>Inches</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+            </Stroke>
+          </AreaSymbolization2D>
+        </AreaRule>
+      </AreaTypeStyle>
+    </VectorScaleRange>
+  </VectorLayerDefinition>
+</LayerDefinition>
\ No newline at end of file

Added: sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.mdf
===================================================================
--- sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.mdf	                        (rev 0)
+++ sandbox/jng/basic_label_justification/UnitTest/TestData/Symbology/UT_LabelJustifyRight.mdf	2023-02-04 13:50:48 UTC (rev 10024)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+  <Name>New Map</Name>
+  <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+  <Extents>
+    <MinX>-87.76498623679663</MinX>
+    <MaxX>-87.69551753753811</MaxX>
+    <MinY>43.691398447253356</MinY>
+    <MaxY>43.7975198255836</MaxY>
+  </Extents>
+  <BackgroundColor>ffffffff</BackgroundColor>
+  <MapLayer>
+    <Name>Districts</Name>
+    <ResourceId>Library://UnitTests/Layers/LabelJustifyRight.LayerDefinition</ResourceId>
+    <Selectable>true</Selectable>
+    <ShowInLegend>true</ShowInLegend>
+    <LegendLabel>Districts</LegendLabel>
+    <ExpandInLegend>true</ExpandInLegend>
+    <Visible>true</Visible>
+    <Group />
+  </MapLayer>
+</MapDefinition>
\ No newline at end of file



More information about the mapguide-commits mailing list