Ejemplo n.º 1
0
    static void Main()
    {
        MapFigApplication api = new MapFigApplication("https://studio.mapfig.com", "Za40iR62wtzc8HWs4TgJhNSI8_wRcqMa");

        try
        {
            Map map = api.get(491); // it'll return the Map Object. 424 is the user's MapId
            Console.WriteLine(map.getWholeDataArray());
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }
        static void Main()
        {
            MapFigApplication api = new MapFigApplication("https://studio.mapfig.com", "Za40iR62wtzc8HWs4TgJhNSI8_wRcqMa");

            Map map = null;

            try
            {
                map = api.get(430);  // First of all get the map by ID
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }


            if (map != null) // if map Found
            {

                // TODO with map - Update Map object here
                /* Update the Map here*/
                map.setLayerId(1);  // Default 1 or change it to the account owner's layer ID
                map.setGroupId(0);  // Default 0 or change it to the account owner's layer group ID
                map.setPassword("");  // Default NONE or change it to the Desire Password to protact the Map
                map.setUseCluster(true);  // Default false
                map.setOverlayEnable(true);  // Default false
                map.setOverlayTitle("Updated Overlay Title");  // Default NONE
                map.setOverlayContent("Updated Overlay Content");  // Default NONE
                map.setOverlayBlurb("Example Blurb");  // Default NONE
                map.setLegendEnable(false);  // Default false
                map.setLegendContent("HTML content here");  // Default NONE
                map.setProjectId(0);	// Default 0 or change it to the account owner's project ID
                map.setShowSidebar(true);  // Default true
                map.setShowExport(true);  // Default false
                map.setShowMeasure(true);  // Default false
                map.setShowMinimap(true);  // Default false
                map.setShowSearch(true);  // Default false
                map.setShowFilelayer(false);  // Default false // shows local file upload button
                map.setShowSvg(false);  // Default false
                map.setShowStaticSidebar(false);  // Default false
                map.setStaticSidebarContent("");  // Default NONE

                // map.dropAllShapes(); it'll remove all the shapes from Map
                // You can add more Markers
                Marker marker = new Marker(48.856614, 2.3522219000000177); // One Way - provide Latitude/Longitude directly
                /* Properties */
                marker.setLocation("New York");
                marker.setDescription("<p>This is where you can write the <strong>HTML</strong> code too</p>");
                /* Advance Properties */
                marker.setShowGetDirection(false);
                marker.setShowInfoBox(true);
                marker.setShowLocationOnPopup(true);
                marker.setHideLabel(true);
                /* Styling */
                marker.setMarkerStyle(""); // Default NONE, available options are (user,cog,leaf,home,.....) 
                // Complete list can be found here http://fortawesome.github.io/Font-Awesome/icons/
                marker.setMarkerColor(""); // Default NONE, available options are 
                // (Red,Blue,Green,Purple,Orange,Darkred,Lightred,Beige,Darkblue,Darkpurple,White,
                //  Pink,Lightblue,Lightgreen,Gray,Black,cadetblue,Brown,Lightgray)
                map.addShape(marker);



                // Save the map and get the MapID if successfully saved
                String response = api.update(map);

                // TODO with response
                Console.WriteLine(response);

            }

        }