Пример #1
0
        /// <summary>
        /// KmlDocument 의 Visibility 변경
        /// </summary>
        /// <param name="document"></param>
        /// <param name="isVisible"></param>
        public void SetKmlDocumentVisible(IKmlDocument document, bool isVisible)
        {
            if (document == null)
            {
                System.Console.WriteLine("SetKmlDocumentVisible - KmlDocument is null");
                FileLogManager.GetInstance().WriteLog("[GEController] SetKmlDocumentVisible( KmlDocument is null )");

                return;
            }

            try
            {
                document.setVisibility(Convert.ToInt32(isVisible));

                KmlObjectListCoClass kmlObjectListCoClass = document.getFeatures().getChildNodes();
                for (int i = 0; i < kmlObjectListCoClass.getLength(); i++)
                {
                    IKmlObject kmlObject = kmlObjectListCoClass.item(i);
                    string     strType   = kmlObject.getType();
                    if (strType == "KmlPlacemark")
                    {
                        IKmlPlacemark placemark = kmlObject as IKmlPlacemark;
                        placemark.setVisibility(Convert.ToInt32(isVisible));
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("SetKmlDocumentVisible Exception : " + ex.ToString());
                FileLogManager.GetInstance().WriteLog("[GEController] SetKmlDocumentVisible( " + ex.ToString() + " )");
            }
        }
Пример #2
0
        private void selectTextDataRow(object sender, DataGridViewCellMouseEventArgs e)
        {
            if ( textPointSet == true )
            {
                ge.getFeatures().removeChild(start);
                ge.getFeatures().removeChild(finish);
            }
            float scale = 2;
            textPointSet = true;
            //When you select a row in the DataTable it populates it's information in the Panel
            DataGridViewRow row = textDataGrid.SelectedRows[0];
            startTimeText.Text = row.Cells[7].Value.ToString();
            finishTimeText.Text = row.Cells[8].Value.ToString();
            startCoordinatesText.Text = row.Cells[12].Value.ToString() + ", " + row.Cells[13].Value.ToString();
            finishCoordinatesText.Text = row.Cells[14].Value.ToString() + ". " + row.Cells[15].Value.ToString();
            distanceText.Text = row.Cells[10].Value.ToString() + " km";
            timeText.Text = row.Cells[9].Value.ToString() + " hrs";
            speedText.Text = Math.Round(Convert.ToDecimal(row.Cells[11].Value), 2).ToString() + " kmph";
            panel6.Visible = true;

            IKmlIcon startIcon = ge.createIcon("");
            startIcon.setHref("http://maps.google.com/mapfiles/kml/paddle/S.png");
            IKmlStyle startPointStyle = ge.createStyle("");
            startPointStyle.getIconStyle().setIcon(startIcon);
            startPointStyle.getIconStyle().setScale(scale);

            IKmlIcon finishIcon = ge.createIcon("");
            finishIcon.setHref("http://maps.google.com/mapfiles/kml/paddle/F.png");
            IKmlStyle finishPointStyle = ge.createStyle("");
            finishPointStyle.getIconStyle().setIcon(finishIcon);
            finishPointStyle.getIconStyle().setScale(scale);

            IKmlPlacemark textTripStartPlaceMark = ge.createPlacemark("start" + temp);
            IKmlPlacemark textTripFinishPlaceMark = ge.createPlacemark("finish" + temp);
            ++temp;

            textTripStartPlaceMark.setStyleSelector(startPointStyle);
            textTripFinishPlaceMark.setStyleSelector(finishPointStyle);

            IKmlPoint textTripStartPoint = ge.createPoint("");
            IKmlPoint textTripFinishPoint = ge.createPoint("");

            textTripStartPoint.setLatitude(Convert.ToDouble(row.Cells[13].Value));
            textTripStartPoint.setLongitude(Convert.ToDouble(row.Cells[12].Value));

            textTripFinishPoint.setLatitude(Convert.ToDouble(row.Cells[15].Value));
            textTripFinishPoint.setLongitude(Convert.ToDouble(row.Cells[14].Value));

            textTripStartPlaceMark.setGeometry(textTripStartPoint);
            textTripFinishPlaceMark.setGeometry(textTripFinishPoint);

            ge.getFeatures().appendChild(textTripStartPlaceMark);
            ge.getFeatures().appendChild(textTripFinishPlaceMark);

            start = textTripStartPlaceMark;
            finish = textTripFinishPlaceMark;

            if (textPointHide)
            {
                start.setVisibility(0);
                finish.setVisibility(0);
            }
        }
Пример #3
0
        private void selectKMLDataRow(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (KMLPointSet == true)
            {
                ge.getFeatures().removeChild(KMLStart);
                ge.getFeatures().removeChild(KMLFinish);
            }
            float scale = 2;
            KMLPointSet = true;
            //When you select a row in the DataTable it populates it's information in the Panel
            DataGridViewRow row = KMLTripView.SelectedRows[0];
            startTimeText.Text = row.Cells[7].Value.ToString();
            finishTimeText.Text = row.Cells[8].Value.ToString();
            startCoordinatesText.Text = row.Cells[12].Value.ToString() + ", " + row.Cells[13].Value.ToString();
            finishCoordinatesText.Text = row.Cells[14].Value.ToString() + ". " + row.Cells[15].Value.ToString();
            distanceText.Text = row.Cells[10].Value.ToString() + " km";
            timeText.Text = row.Cells[9].Value.ToString() + " hrs";
            speedText.Text = Math.Round(Convert.ToDecimal(row.Cells[11].Value), 2).ToString() + " kmph";
            panel6.Visible = true;

            IKmlIcon KMLstartIcon = ge.createIcon("");
            KMLstartIcon.setHref("http://www.vishwaas.org.au/icons/KMLStart.png");
            IKmlStyle KMLstartPointStyle = ge.createStyle("");
            KMLstartPointStyle.getIconStyle().setIcon(KMLstartIcon);
            KMLstartPointStyle.getIconStyle().setScale(scale);

            IKmlIcon KMLfinishIcon = ge.createIcon("");
            KMLfinishIcon.setHref("http://www.vishwaas.org.au/icons/KMLFinish.png");
            IKmlStyle KMLfinishPointStyle = ge.createStyle("");
            KMLfinishPointStyle.getIconStyle().setIcon(KMLfinishIcon);
            KMLfinishPointStyle.getIconStyle().setScale(scale);

            IKmlPlacemark KMLTripStartPlaceMark = ge.createPlacemark("KMLstart" + temp);
            IKmlPlacemark KMLTripFinishPlaceMark = ge.createPlacemark("KMLfinish" + temp);
            ++temp;

            KMLTripStartPlaceMark.setStyleSelector(KMLstartPointStyle);
            KMLTripFinishPlaceMark.setStyleSelector(KMLfinishPointStyle);

            IKmlPoint KMLTripStartPoint = ge.createPoint("");
            IKmlPoint KMLTripFinishPoint = ge.createPoint("");

            KMLTripStartPoint.setLatitude(Convert.ToDouble(row.Cells[13].Value));
            KMLTripStartPoint.setLongitude(Convert.ToDouble(row.Cells[12].Value));

            KMLTripFinishPoint.setLatitude(Convert.ToDouble(row.Cells[15].Value));
            KMLTripFinishPoint.setLongitude(Convert.ToDouble(row.Cells[14].Value));

            KMLTripStartPlaceMark.setGeometry(KMLTripStartPoint);
            KMLTripFinishPlaceMark.setGeometry(KMLTripFinishPoint);

            ge.getFeatures().appendChild(KMLTripStartPlaceMark);
            ge.getFeatures().appendChild(KMLTripFinishPlaceMark);

            KMLStart = KMLTripStartPlaceMark;
            KMLFinish = KMLTripFinishPlaceMark;

            if (KMLPointhide)
            {
                KMLStart.setVisibility(0);
                KMLFinish.setVisibility(0);
            }
        }