Exemplo n.º 1
0
        /// <summary>
        /// Icon을 생성하여 GEPlugin 에 Append
        /// </summary>
        /// <param name="placemarkID"></param>
        /// <param name="iconName"></param>
        /// <param name="iconURL"></param>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        public void CreateSystemIcon(string placemarkID, string iconName, string iconUrl, double latitude, double longitude)
        {
            try
            {
                if (this.ge == null)
                {
                    FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon( GEPlugin is null. )");

                    throw new Exception("External Exception : GEPlugin is null.");
                }

                //아이콘 생성---------------------------------------시작
                IKmlPlacemark placemark = ge.createPlacemark("icon" + placemarkID);
                placemark.setDescription(iconName);
                if (!string.IsNullOrEmpty(iconUrl))
                {
                    //아이콘 스타일 변경----------------------------시작
                    IKmlIcon icon = ge.createIcon("");
                    icon.setHref(iconUrl);
                    IKmlStyle style = ge.createStyle("");
                    style.getIconStyle().setIcon(icon);
                    placemark.setStyleSelector(style);
                    //아이콘 스타일 변경------------------------------끝
                }
                else
                {
                    //아이콘 스타일 변경----------------------------시작
                    IKmlIcon icon = ge.createIcon("");
                    icon.setHref("http://maps.google.com/mapfiles/kml/paddle/red-circle.png");
                    IKmlStyle style = ge.createStyle("");
                    style.getIconStyle().setIcon(icon);
                    placemark.setStyleSelector(style);
                    //아이콘 스타일 변경------------------------------끝
                }
                IKmlPoint point = ge.createPoint("");
                point.setLatitude(latitude);
                point.setLongitude(longitude);
                placemark.setGeometry(point);
                ge.getFeatures().appendChild(placemark);
                //아이콘 생성-----------------------------------------끝
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("CreateSystemIcon Exception : " + ex.ToString());
                FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon( " + ex.ToString() + " )");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get the current pluin view as a point object
 /// </summary>
 /// <param name="ge">the plugin</param>
 /// <returns>Point set to the current view</returns>
 public static IKmlPoint GetCurrentViewAsPoint(IGEPlugin ge)
 {
     IKmlLookAt lookat = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
     IKmlPoint point = ge.createPoint(String.Empty);
     point.set(
         lookat.getLatitude(),
         lookat.getLongitude(),
         lookat.getAltitude(),
         ge.ALTITUDE_RELATIVE_TO_GROUND,
         0,
         0);
     return point;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create look at mode
        /// </summary>
        public void CreateLookAt()
        {
            KmlLookAtCoClass lookAt = ge.createLookAt("");

            lookAt.set(Latitude, Longitude, Altitude, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, Range);
            ge.getView().setAbstractView(lookAt);

            ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, 1);


            //create a point
            KmlPointCoClass point = ge.createPoint("");

            point.setLatitude(lookAt.getLatitude());
            point.setLongitude(lookAt.getLongitude());

            //create a placemark
            KmlPlacemarkCoClass placemark = ge.createPlacemark("");

            placemark.setName("Start Position");
            placemark.setGeometry(point);

            ge.getFeatures().appendChild(placemark);
        }
Exemplo n.º 4
0
        public Boolean insert(String tp1, String tp2)
        {
            try
            {
                // Get the end placemark of the 1st trip  and the start placemark of the second trip
                IKmlPlacemark tp1fn = t_pool.getFinish(t_pool.getByName(tp1));
                IKmlPlacemark tp2st = t_pool.getStart(t_pool.getByName(tp2));

                //create a place mark to store the new place mark

                IKmlPlacemark start  = ge.createPlacemark("");
                IKmlPlacemark finish = ge.createPlacemark("");

                start.setName(tp1fn.getName());
                finish.setName(tp2st.getName());

                IKmlPoint sp = ge.createPoint("");
                IKmlPoint fp = ge.createPoint("");

                IKmlPlacemark _temp = ge.createPlacemark("");

                IKmlLineString temp = ge.createLineString("");

                // Retrieve the coordinates of the two trips
                Hashtable cds1 = Module.getCoordinates(tp1fn);
                Hashtable cds2 = Module.getCoordinates(tp2st);

                sp.setLatLng((double)cds1["lat"], (double)cds1["lon"]);
                start.setGeometry(sp);
                fp.setLatLng((double)cds2["lat"], (double)cds2["lon"]);
                finish.setGeometry(fp);

                String color = randomCol();

                IKmlStyleMap sm        = ge.createStyleMap("");
                IKmlStyle    normal    = mkStyle(color, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3);
                IKmlStyle    highlight = mkStyle(color, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4);
                sm.setNormalStyle(normal);
                sm.setHighlightStyle(highlight);
                start.setStyleSelector(sm);
                finish.setStyleSelector(sm);

                temp.getCoordinates().pushLatLngAlt((double)cds1["lat"], (double)cds1["lon"], 0);
                temp.getCoordinates().pushLatLngAlt((double)cds2["lat"], (double)cds2["lon"], 0);
                _temp.setGeometry(temp);

                IKmlStyle sty = ge.createStyle("");
                sty.getLineStyle().setWidth((float)4);
                sty.getLineStyle().getColor().set(color);

                _temp.setStyleSelector(sty);

                //create a new KML folder for the new trip  and append the tmp features of the previous trip
                IKmlFolder temp1 = ge.createFolder("");

                temp1.getFeatures().appendChild(start);
                temp1.getFeatures().appendChild(_temp);
                temp1.getFeatures().appendChild(finish);

                String[] attributes = new String[14];

                //Add the new trip to the trip pools
                t_pool.add(tp2, temp1, attributes);
                ge.getFeatures().appendChild(temp1);

                // record the insert action for undo action
                record.ins_trip(tp2);


                return(true);
            }
            catch
            {
                return(false);
            }
        }