예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GooglePoint"/> struct.
 /// </summary>
 /// <param name="source">The source.</param>
 public GoogleLocation(GoogleLocation source)
 {
     _latitude = source.Latitude;
     _longitude = source.Longitude;
     _tracking = source._tracking;
 }
예제 #2
0
 /// <summary>
 /// Changes the center point of the map to the given point. 
 /// If the point is already visible in the current map view, change the center in a smooth animation.
 /// </summary>
 /// <param name="center">The center.</param>
 public void PanTo(GoogleLocation center)
 {
     this.Actions.Add(
         string.Format("{0}.panTo(new GLatLng({1}, {2}));",
             this.ClientMapID,
             JsUtil.Encode(this.Latitude),
             JsUtil.Encode(this.Longitude)
         )
     );
 }
예제 #3
0
 /// <summary>
 /// Opens a simple info window at the given point. 
 /// Pans the map such that the opened info window is fully visible. 
 /// The content of the info window is given as HTML text.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <param name="text">The text.</param>
 /// <param name="options">The options.</param>
 public void OpenInfoWindowHtml(GoogleLocation point, string text, string options)
 {
     this.Actions.Add(
         string.Format("{0}.openInfoWindowHtml(new GLatLng({1}, {2}), {3} {4});",
             this.ClientMapID,
             JsUtil.Encode(this.Latitude),
             JsUtil.Encode(this.Longitude),
             JsUtil.Encode(text),
             string.IsNullOrEmpty(options) ? string.Empty : "," + JsUtil.Encode(options)
         )
     );
 }
 /// <summary>
 /// Builds the points.
 /// </summary>
 void BuildPoints()
 {
     bool canBuild = (Latitude !=0 && Longitude != 0 && Radius != 0);
     if (canBuild) {
         this.Points.Clear();
         double d2r = Math.PI / 180.0D; // degree to radian
         double r2d = 180.0D / Math.PI;
         double lat = ((double)Radius / 3963.0D) * r2d;
         double lng = lat / Math.Cos(Latitude * d2r);
         double theta, x, y;
         GoogleLocation firstPoint = null;
         for (int i = 0; i < 33; i++) {
             theta = (double)Math.PI * ((double)i / 16.0D);
             x = Latitude + (lat * Math.Sin(theta));
             y = Longitude + (lng * Math.Cos(theta));
             if (firstPoint != null) {
                 this.Points.Add(new GoogleLocation(x, y));
             }
             else {
                 this.Points.Add(firstPoint = new GoogleLocation(x, y));
             }
         }
         this.Points.Add(firstPoint);
     }
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoogleLocationEventArgs"/> class.
 /// </summary>
 /// <param name="location">The location.</param>
 public GoogleLocationEventArgs(GoogleLocation location)
 {
     this.Location = location;
 }
        public void CalculateConsolidationSolution()
        {
            CLSCOBO_ConsolidationEngine ao_ConsolidationEngine;
            CLSCOBO_OriginPoint vo_OriginPoint=null;
            GooglePolyline vo_PolyLine=null;
            GoogleLocation vo_GoogleLocation;
            Color vo_Color=Color.Black;
            int pi_Quadrant=0;

            int x = 0;
            if(ao_GoogleMap==null)
                ao_GoogleMap=(GoogleMap)CLSCOBO_FunctionsRepository.getElement("GoogleMap1", ao_WebPage);

            if (ao_ConsolidationProblem != null){
                ao_ConsolidationEngine = new CLSCOBO_ConsolidationEngine(ao_ConsolidationProblem);
                foreach(CLSCOBO_ConsolidationSolution vo_ConsolidationSolutionPointer in ao_ConsolidationEngine.ConsolidationSolutions) {
                //CLSCOBO_ConsolidationSolution vo_ConsolidationSolutionPointer=ao_ConsolidationEngine.ConsolidationSolutions[ao_ConsolidationEngine.ConsolidationSolutions.Count-1];
                    ao_GoogleMap.Polylines.Clear();
                    pi_Quadrant=0;
                    foreach(CLSCOBO_TruckItinerary vo_TruckItineraryPointer in vo_ConsolidationSolutionPointer.TruckItineraries) {
                        vo_PolyLine=new GooglePolyline();
                        vo_PolyLine.Color=(pi_Quadrant==1)?Color.Blue:(pi_Quadrant==2)?Color.Red:(pi_Quadrant==3)?Color.Green:Color.Gold;

                        vo_OriginPoint=ao_ConsolidationEngine.ConsolidationSolutions[x].TruckItineraries[0].OriginPoint;
                        vo_GoogleLocation=new GoogleLocation(vo_OriginPoint.Latitude, vo_OriginPoint.Longitude);
                        vo_PolyLine.Points.Add(vo_GoogleLocation);
                        foreach(CLSCOBO_DeliveryPoint vo_DeliveryPointPointer in vo_TruckItineraryPointer.Deliveries) {
                            vo_GoogleLocation=new GoogleLocation(vo_DeliveryPointPointer.Latitude, vo_DeliveryPointPointer.Longitude);
                            if((vo_GoogleLocation.Latitude!=0) && (vo_GoogleLocation.Longitude!=0)) {
                                vo_PolyLine.Points.Add(vo_GoogleLocation);
                            }
                        }
                        pi_Quadrant++;
                        ao_GoogleMap.Polylines.Add(vo_PolyLine);
                        System.Threading.Thread.Sleep(50);
                    }

                }
            }
        }