Exemplo n.º 1
0
        // When session is dirty but it is first time for user, this will be applied to give users it's initial state
        private void RestoreDefaultState(Map map)
        {
            HttpApplicationState application = HttpContext.Current.Application;

            // Get the default layers, center, and zoomfrom the Application. Clear Layers first,
            //this resets the zoom and center which we will set later
            map.Layers.Clear();

            //Just by deserializing the binary stream we reset the MapFactory Deault layers collection
            byte[] bytes = application["DefaultLayers"] as byte[];
            Object obj   = ManualSerializer.ObjectFromBinaryStream(bytes);

            //map.Layers.Add(obj as IMapLayer);

            // For default selection
            bytes = application["DefaultSelection"] as byte[];
            obj   = ManualSerializer.ObjectFromBinaryStream(bytes);
            //MapInfo.Engine.Session.Current.Selections.DefaultSelection = obj;

            // For zoom and center
            map.Zoom   = (MapInfo.Geometry.Distance)application["DefaultZoom"];
            map.Center = (DPoint)application["DefaultCenter"];
            // TESTONLY
            // HttpContext.Current.Response.Write("<br><br><br><br><br><br><br><br><br><br>RestoreDefaultState");
        }
Exemplo n.º 2
0
        // When session is dirty but it is first time for user, this will be applied to give users it's initial state
        private void RestoreDefaultState(Map map)
        {
            HttpApplicationState application = HttpContext.Current.Application;

            // Get the default layers, center, and zoomfrom the Application. Clear Layers first,
            //this resets the zoom and center which we will set later
            map.Layers.Clear();

            //Just by deserializing the binary stream we reset the MapFactory Deault layers collection
            byte[] bytes = application["Layers"] as byte[];
            Object obj   = ManualSerializer.ObjectFromBinaryStream(bytes);

            // For default selection
            bytes = application["Selection"] as byte[];
            obj   = ManualSerializer.ObjectFromBinaryStream(bytes);

            // For zoom and center
            map.Zoom   = (MapInfo.Geometry.Distance)application["Zoom"];
            map.Center = (DPoint)application["Center"];
        }
        // When session is dirty but it is first time for user, this will be applied to give users it's initial state
        private void RestoreDefaultState(Map map)
        {
            HttpApplicationState application = HttpContext.Current.Application;

            // Get the default layers, center, and zoomfrom the Application. Clear Layers first,
            // this resets the zoom and center which we will set later
            map.Layers.Clear();

            // Just by deserializing the binary stream we reset the MapFactory Deault layers collection
            // Any MapXtreme class that supports the ISerializable interface will automatically be
            // restored to the current MapXtreme Session.
            byte[] bytes = application["DefaultLayers"] as byte[];
            Object obj   = ManualSerializer.ObjectFromBinaryStream(bytes);

            // Deserialzing rules are the same for the default selection
            bytes = application["DefaultSelection"] as byte[];
            obj   = ManualSerializer.ObjectFromBinaryStream(bytes);

            // For zoom and center, these are simple types and need to be assigned to the map object.
            map.Zoom   = (MapInfo.Geometry.Distance)application["DefaultZoom"];
            map.Center = (DPoint)application["DefaultCenter"];
        }