Map server code

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Map server code

snrsarker
Hi,
I am using the following javascript/fusion code to plot a point(X,Y) on the map in AIMS. But it is not working.
 function ProcessCallBackResult(resulthtml)
    {
      var points = resulthtml.split('||');
      var point1 = points[0].split('|');
      var x1 = point1[0].valueOf();
     var y1 = point1[1].valueOf();
     var pnt = new Point(x1, y1);
     var geom = pnt.X + ',' + pnt.Y;
    
    DigitizePointCustom(pnt);
    // mgApiCallHandlerCustom(pnt);
   
   //  Refresh();  

    function DigitizePointCustom(handler) {
        mgApiStartDigitizingCustom('point', handler)
    }

    function mgApiStartDigitizingCustom(type, handler)
    {
        //var mgApiMapWidgetIdCustom = 'Library://DFCC/Layout/Bhaupur.ApplicationDefinition';
        var mgApiMapWidgetIdCustom = 'Map';
        var mgApiActiveWidgetCustom = null;
        var mgApiActiveControlCustom = null;
        var mgApiDrawControlsCustom;
        var mgApiDigitizingLayerCustom = null;
        var mgApiInitializedCustom = false;
        mgApiInit();
        if (handler)
         {
            //var Fusion = window.top.Fusion;
             var mapWidgetCustom = Fusion.getWidgetById(mgApiMapWidgetIdCustom);
            var map = Fusion.getWidgetById(mgApiMapWidgetIdCustom).oMapOL;
            //mgApiActiveWidgetCustom = mapWidgetCustom.oActiveWidget;
           
            //var map = Fusion.getWidgetById(mgApiActiveWidgetCustom).oMapOL;
            var mgApiStyleCustom = new OpenLayers.Style({
            pointRadius: 4,
            graphicName: "square",
            fillColor: "blue",
            fillOpacity: 0.4,
            strokeWidth: 2,
            strokeOpacity: 1,
            strokeColor: "#666666"
        });
        var mgApiStyleMapCustom = new OpenLayers.StyleMap(mgApiStyleCustom);
       
        Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED, mgApiInit);
         /*Digitizing tool initialization*/
         mgApiDigitizingLayerCustom = new OpenLayers.Layer.Vector("Digitizing Layer", {styleMap: mgApiStyleMapCustom,geometryType: 'Point'});
         //mgApiCallHandlerCustom(handler)
         map.addLayers([mgApiDigitizingLayerCustom]);
         mgApiDrawControlsCustom = { point: new OpenLayers.Control.DrawFeature(mgApiDigitizingLayerCustom, OpenLayers.Handler.Point, { handlerOptions: { layerOptions: { styleMap: mgApiStyleMapCustom}} }) }
        
            if (mgApiActiveWidgetCustom) {
                mapWidgetCustom.deactivateWidget(mgApiActiveWidgetCustom);
            }
        }
       
       
    }
//    function mgApiStyleCustom() {
//        var mgApiStyleCustom = new OpenLayers.Style({
//            pointRadius: 4,
//            graphicName: "circle",
//            fillColor: "red",
//            fillOpacity: 0.4,
//            strokeWidth: 2,
//            strokeOpacity: 1,
//            strokeColor: "#666666"
//        });
//        var mgApiStyleMap = new OpenLayers.StyleMap(mgApiStyleCustom);
//   
//        Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED, mgApiInit);
 
    //     var point2 = points[1].split('|');
    //     var x2 = point2[0];
    //     var y2 = point2[1];
    //     DigitizePoint(Point);
    //     Point.x
}
function mgApiCallHandlerCustom(evt) {
    var geom = evt.feature.geometry;
    var apiGeom = null;
    this.handler.CLASS_NAME = 'OpenLayers.Geometry.Point';
    apiGeom = new Point(geom.x, geom.y);
   
}
//function mgApiDeactivate() {
//    if (mgApiActiveControl) {
//        mgApiActiveControl.deactivate();
//        mgApiActiveControl = null;
//    function OnPointDigitized(point)
//    {

//        var geomText = "X: " + point.X + "<br>" + "Y: " + point.Y;
//        showCoordniate(geomText);
//    }
</script>
However my point is not visible as a seperate layer on the map. Please help.
 
Best Regards,
Soumyajit Sarker
Business Analyst, Geospatial Solutions
HCL Technologies Ltd. | Noida - India | Mobile: 9211247194



::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------


_______________________________________________
fusion-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-dev