SizeLatLng.cs :  » GIS » GMap.NET » GMap » NET » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GIS » GMap.NET 
GMap.NET » GMap » NET » SizeLatLng.cs

namespace GMap.NET{
   using System.Globalization;

   /// <summary>
   /// the size of coordinates
   /// </summary>
   public struct SizeLatLng
   {
      public static readonly SizeLatLng Empty;

      private double heightLat;
      private double widthLng;

      public SizeLatLng(SizeLatLng size)
      {
         this.widthLng = size.widthLng;
         this.heightLat = size.heightLat;
      }

      public SizeLatLng(PointLatLng pt)
      {
         this.heightLat = pt.Lat;
         this.widthLng = pt.Lng;
      }

      public SizeLatLng(double heightLat, double widthLng)
      {
         this.heightLat = heightLat;
         this.widthLng = widthLng;
      }

      public static SizeLatLng operator+(SizeLatLng sz1, SizeLatLng sz2)
      {
         return Add(sz1, sz2);
      }

      public static SizeLatLng operator-(SizeLatLng sz1, SizeLatLng sz2)
      {
         return Subtract(sz1, sz2);
      }

      public static bool operator==(SizeLatLng sz1, SizeLatLng sz2)
      {
         return ((sz1.WidthLng == sz2.WidthLng) && (sz1.HeightLat == sz2.HeightLat));
      }

      public static bool operator!=(SizeLatLng sz1, SizeLatLng sz2)
      {
         return !(sz1 == sz2);
      }

      public static explicit operator PointLatLng(SizeLatLng size)
      {
         return new PointLatLng(size.HeightLat, size.WidthLng);
      }


      public bool IsEmpty
      {
         get
         {
            return ((this.widthLng == 0d) && (this.heightLat == 0d));
         }
      }

      public double WidthLng
      {
         get
         {
            return this.widthLng;
         }
         set
         {
            this.widthLng = value;
         }
      }

      public double HeightLat
      {
         get
         {
            return this.heightLat;
         }
         set
         {
            this.heightLat = value;
         }
      }

      public static SizeLatLng Add(SizeLatLng sz1, SizeLatLng sz2)
      {
         return new SizeLatLng(sz1.HeightLat + sz2.HeightLat, sz1.WidthLng + sz2.WidthLng);
      }

      public static SizeLatLng Subtract(SizeLatLng sz1, SizeLatLng sz2)
      {
         return new SizeLatLng(sz1.HeightLat - sz2.HeightLat, sz1.WidthLng - sz2.WidthLng);
      }

      public override bool Equals(object obj)
      {
         if(!(obj is SizeLatLng))
         {
            return false;
         }
         SizeLatLng ef = (SizeLatLng) obj;
         return (((ef.WidthLng == this.WidthLng) && (ef.HeightLat == this.HeightLat)) && ef.GetType().Equals(base.GetType()));
      }

      public override int GetHashCode()
      {
         return base.GetHashCode();
      }

      public PointLatLng ToPointLatLng()
      {
         return (PointLatLng) this;
      }

      public override string ToString()
      {
         return ("{WidthLng=" + this.widthLng.ToString(CultureInfo.CurrentCulture) + ", HeightLng=" + this.heightLat.ToString(CultureInfo.CurrentCulture) + "}");
      }

      static SizeLatLng()
      {
         Empty = new SizeLatLng();
      }
   }
}
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.