public void TestCacheModifySymbol()
        {
            using (ShimsContext.Create())
              {
            client.Geometry.MapPoint p = new client.Geometry.MapPoint(0.0, 0.0);
            clientfake.ShimGraphic g = new clientfake.ShimGraphic();
            client.FeatureService.Symbols.PictureMarkerSymbol pms = new client.FeatureService.Symbols.PictureMarkerSymbol();
            Uri myUri = new Uri("../../resources/zoom_in_tool_1.bmp", UriKind.RelativeOrAbsolute);

            BitmapDecoder decoder = new BmpBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
            BitmapSource bitmapSource = decoder.Frames[0];
            pms.Source = bitmapSource;
            clientfake.ShimUniqueValueRenderer r = new clientfake.ShimUniqueValueRenderer();
            Dictionary<String, Object> attributes = new Dictionary<String, Object>();
            attributes["uniquedesignation"] = "Wolfpack 1 C";
            attributes["owningunit"] = "2nd Stryker Brigade";
            attributes["type"] = "M1128";
            g.AttributesGet = () => { return attributes; };
            g.GeometryGet = () => { return p; };
            Dictionary<String, String> fields = new Dictionary<String, String>();
            fields["UID"] = "uniquedesignation";
            fields["HF"] = "owningunit";
            fields["LABELS"] = "uniquedesignation";
            fields["DESCFLDS"] = "type";
            fields["DESCFIELD"] = "type";
            int count = cache.RetrieveFeatureCache("EQUIPMENT").Count;
            cache.AddFeature("EQUIPMENT", g, "Type: {type}", "{uniquedesignation}", fields, r);
            fields["LABELS"] = "uniquedesignation,owningunit";
            g.SymbolGet = () => { return pms; };
            cache.UpdateFeature("EQUIPMENT", "Wolfpack 1 C", "Type: {type}", "{uniquedesignation} owned by {owningunit}", g, fields);
            Dictionary<String, Dictionary<String, Object>> fcache = cache.RetrieveFeatureCache("EQUIPMENT");
            Dictionary<String, Object> f = fcache["Wolfpack 1 C"];
            ImageSource imsrc = f["ICON"] as ImageSource;
            Assert.AreEqual(pms.Source, imsrc);
              }
        }
Example #2
0
 public void TestCacheIsDirty()
 {
     using (ShimsContext.Create())
     {
         client.Geometry.MapPoint           p          = new client.Geometry.MapPoint(0.0, 0.0);
         clientfake.ShimGraphic             g          = new clientfake.ShimGraphic();
         clientfake.ShimUniqueValueRenderer r          = new clientfake.ShimUniqueValueRenderer();
         Dictionary <String, Object>        attributes = new Dictionary <String, Object>();
         attributes["uniquedesignation"] = "Wolfpack 1 C";
         attributes["owningunit"]        = "2nd Stryker Brigade";
         attributes["type"] = "M1128";
         g.AttributesGet    = () => { return(attributes); };
         g.GeometryGet      = () => { return(p); };
         Dictionary <String, String> fields = new Dictionary <String, String>();
         fields["UID"]       = "uniquedesignation";
         fields["HF"]        = "owningunit";
         fields["LABELS"]    = "uniquedesignation";
         fields["DESCFLDS"]  = "type";
         fields["DESCFIELD"] = "type";
         int count = cache.RetrieveFeatureCache("EQUIPMENT").Count;
         cache.AddFeature("EQUIPMENT", g, "Type: {type}", "{uniquedesignation}", fields, r);
         fields["LABELS"] = "uniquedesignation,owningunit";
         cache.UpdateFeature("EQUIPMENT", "Wolfpack 1 C", "Type: {type}", "{uniquedesignation} owned by {owningunit}", g, fields);
         Dictionary <String, Dictionary <String, Object> > fcache = cache.RetrieveFeatureCache("EQUIPMENT");
         Dictionary <String, Object> f = fcache["Wolfpack 1 C"];
         String label = f["LABEL"].ToString();
         Assert.IsTrue(cache.IsDirty);
     }
 }
Example #3
0
 public void TestCacheUpdateFeature()
 {
     using (ShimsContext.Create())
     {
         client.Geometry.MapPoint           p          = new client.Geometry.MapPoint(0.0, 0.0);
         clientfake.ShimGraphic             g          = new clientfake.ShimGraphic();
         clientfake.ShimUniqueValueRenderer r          = new clientfake.ShimUniqueValueRenderer();
         Dictionary <String, Object>        attributes = new Dictionary <String, Object>();
         attributes["uniquedesignation"] = "1-1";
         attributes["higherformation"]   = "1";
         g.AttributesGet = () => { return(attributes); };
         g.GeometryGet   = () => { return(p); };
         Dictionary <String, String> fields = new Dictionary <String, String>();
         fields["UID"]       = "uniquedesignation";
         fields["HF"]        = "higherformation";
         fields["LABELS"]    = "uniquedesignation";
         fields["DESCFLDS"]  = null;
         fields["DESCFIELD"] = null;
         int count = cache.RetrieveFeatureCache("UNITS").Count;
         cache.AddFeature("UNITS", g, "", "{uniquedesignation}", fields, r);
         String coords = cache.RetrieveFeatureCache("UNITS")["1-1"]["COORDS"].ToString();
         client.Geometry.MapPoint p1 = new client.Geometry.MapPoint(1.0, 0.0);
         g.GeometryGet = () => { return(p1); };
         cache.UpdateFeature("UNITS", "1-1", "", "{uniquedesignation}", g, fields);
         String newcoords = cache.RetrieveFeatureCache("UNITS")["1-1"]["COORDS"].ToString();
         Assert.AreNotEqual(newcoords, coords);
     }
 }
Example #4
0
        public void TestCacheModifySymbol()
        {
            using (ShimsContext.Create())
            {
                client.Geometry.MapPoint p = new client.Geometry.MapPoint(0.0, 0.0);
                clientfake.ShimGraphic   g = new clientfake.ShimGraphic();
                client.FeatureService.Symbols.PictureMarkerSymbol pms = new client.FeatureService.Symbols.PictureMarkerSymbol();
                Uri myUri = new Uri("../../resources/zoom_in_tool_1.bmp", UriKind.RelativeOrAbsolute);

                BitmapDecoder decoder      = new BmpBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                BitmapSource  bitmapSource = decoder.Frames[0];
                pms.Source = bitmapSource;
                clientfake.ShimUniqueValueRenderer r          = new clientfake.ShimUniqueValueRenderer();
                Dictionary <String, Object>        attributes = new Dictionary <String, Object>();
                attributes["uniquedesignation"] = "Wolfpack 1 C";
                attributes["owningunit"]        = "2nd Stryker Brigade";
                attributes["type"] = "M1128";
                g.AttributesGet    = () => { return(attributes); };
                g.GeometryGet      = () => { return(p); };
                Dictionary <String, String> fields = new Dictionary <String, String>();
                fields["UID"]       = "uniquedesignation";
                fields["HF"]        = "owningunit";
                fields["LABELS"]    = "uniquedesignation";
                fields["DESCFLDS"]  = "type";
                fields["DESCFIELD"] = "type";
                int count = cache.RetrieveFeatureCache("EQUIPMENT").Count;
                cache.AddFeature("EQUIPMENT", g, "Type: {type}", "{uniquedesignation}", fields, r);
                fields["LABELS"] = "uniquedesignation,owningunit";
                g.SymbolGet      = () => { return(pms); };
                cache.UpdateFeature("EQUIPMENT", "Wolfpack 1 C", "Type: {type}", "{uniquedesignation} owned by {owningunit}", g, fields);
                Dictionary <String, Dictionary <String, Object> > fcache = cache.RetrieveFeatureCache("EQUIPMENT");
                Dictionary <String, Object> f = fcache["Wolfpack 1 C"];
                ImageSource imsrc             = f["ICON"] as ImageSource;
                Assert.AreEqual(pms.Source, imsrc);
            }
        }
 public void TestCacheAddFeature()
 {
     using (ShimsContext.Create())
       {
     client.Geometry.MapPoint p = new client.Geometry.MapPoint(0.0, 0.0);
     clientfake.ShimGraphic g = new clientfake.ShimGraphic();
     clientfake.ShimUniqueValueRenderer r = new clientfake.ShimUniqueValueRenderer();
     Dictionary<String, Object> attributes = new Dictionary<String, Object>();
     attributes["uniquedesignation"] = "1-1";
     attributes["higherformation"] = "1";
     g.AttributesGet = () => { return attributes; };
     g.GeometryGet = () => { return p; };
     Dictionary<String, String> fields = new Dictionary<String, String>();
     fields["UID"] = "uniquedesignation";
     fields["HF"] = "higherformation";
     fields["LABELS"] = "uniquedesignation";
     fields["DESCFLDS"] = null;
     fields["DESCFIELD"] = null;
     int count = cache.RetrieveFeatureCache("UNITS").Count;
     cache.AddFeature("UNITS", g, "", "{uniquedesignation}", fields, r);
     Assert.IsTrue(cache.RetrieveFeatureCache("UNITS").Count > count);
       }
 }
 public void TestCacheUpdateFeatureWithDesc()
 {
     using (ShimsContext.Create())
       {
     client.Geometry.MapPoint p = new client.Geometry.MapPoint(0.0, 0.0);
     clientfake.ShimGraphic g = new clientfake.ShimGraphic();
     clientfake.ShimUniqueValueRenderer r = new clientfake.ShimUniqueValueRenderer();
     Dictionary<String, Object> attributes = new Dictionary<String, Object>();
     attributes["uniquedesignation"] = "Wolfpack 1 C";
     attributes["owningunit"] = "2nd Stryker Brigade";
     attributes["type"] = "M1128";
     g.AttributesGet = () => { return attributes; };
     g.GeometryGet = () => { return p; };
     Dictionary<String, String> fields = new Dictionary<String, String>();
     fields["UID"] = "uniquedesignation";
     fields["HF"] = "owningunit";
     fields["LABELS"] = "uniquedesignation";
     fields["DESCFLDS"] = "type";
     fields["DESCFIELD"] = "type";
     int count = cache.RetrieveFeatureCache("EQUIPMENT").Count;
     cache.AddFeature("EQUIPMENT", g, "Type: {type}", "{uniquedesignation} owned by {owningunit}", fields, r);
     cache.UpdateFeature("EQUIPMENT", "Wolfpack 1 C", "{type}", "{uniquedesignation}", g, fields);
     Dictionary<String, Dictionary<String, Object>> fcache = cache.RetrieveFeatureCache("EQUIPMENT");
     Dictionary<String, Object> f = fcache["Wolfpack 1 C"];
     String desc = f["DESCRIPTION"].ToString();
     Assert.AreEqual(desc, "M1128");
       }
 }