//! �����A �� ��B�ľ�γ�ȣ������ǵľ���͵�B����ڵ�A�ķ�λ /*! * \param A A�㾭γ�� * \param B B�㾭γ�� * \param angle B�����A�ķ�λ, ����Ҫ���ظ�ֵ��������Ϊ�� * \return A��B��ľ��� */ //����������������룬����Ϊ������γ�Ƚṹ��һ�����ڼ���ķ���� //��λ��km //���ص�λ��m//2015 public static double distance(ref JWD A, ref JWD B, double angle) { double PI = 3.141592653589793; double dx = (B.m_RadLo - A.m_RadLo) * A.Ed; double dy = (B.m_RadLa - A.m_RadLa) * A.Ec; double outresult = Math.Sqrt(dx * dx + dy * dy); if (angle != 390) { if (dx == 0.0) angle = 0; else if (dy == 0.0) angle = 90; else angle = Math.Atan(Math.Abs(dx / dy)) * 180 / PI;//�õ���ԽǶ� // �ж�����,��һ�����䣬˳ʱ������1-4���� double dLo = B.m_Longitude - A.m_Longitude; double dLa = B.m_Latitude - A.m_Latitude; if (dLo > 0 && dLa <= 0) { angle = (90 - angle) + 90; } else if (dLo <= 0 && dLa < 0) { angle = angle + 180; } else if (dLo < 0 && dLa >= 0) { angle = (90 - angle) + 270; } } //return outresult / 1000; return outresult; }
public void update_min_max_pos() { JWD jwd = new JWD(center.longitude, center.latitude); JWD maxJWD = CJWDHelper.GetJWDB(ref jwd, (Math.Sqrt(2.0) * (radius + 40))/1000.0, 45); JWD minJWD = CJWDHelper.GetJWDB(ref jwd, (Math.Sqrt(2.0) * (radius + 40))/1000.0, 225); minPos.longitude = minJWD.m_Longitude; minPos.latitude = minJWD.m_Latitude; maxPos.longitude = maxJWD.m_Longitude; maxPos.latitude = maxJWD.m_Latitude; }
//���ؽǶ� //����������ľ�γ�ȣ�����������������������ļн� public static double angle(double longitude1, double latitude1, double longitude2, double latitude2) { JWD A=new JWD(longitude1,latitude1); JWD B=new JWD(longitude2,latitude2); return angle(ref A,ref B); }
//! ��֪��A��γ�ȣ�����B���A��ľ��룬�ͷ�λ����B��ľ�γ�� /*! * \param longitude ��֪��A���� * \param latitude ��֪��Aγ�� * \param distance B�㵽A��ľ��� * \param angle B�������A��ķ�λ * \return B��ľ�γ������ */ //ͨ��������һ����ľ�γ�ȣ����룬�Ƕȣ������һ�����λ�� public static JWD GetJWDB(double longitude, double latitude, double distance, double angle) { JWD A=new JWD(longitude,latitude); return GetJWDB(ref A, distance, angle); }
//! ��֪��A��γ�ȣ�����B���A��ľ��룬�ͷ�λ����B��ľ�γ�� /*! * \param A ��֪��A * \param distance B�㵽A��ľ��� * \param angle B�������A��ķ�λ * \return B��ľ�γ������ */ //ͨ��������һ����Ľṹ�����룬�Ƕȣ������һ�����λ�� public static JWD GetJWDB(ref JWD A, double distance, double angle) { double PI = 3.141592653589793; double dx = distance*1000 * Math.Sin(angle * PI /180.0); double dy = distance*1000 * Math.Cos(angle * PI /180.0); //double dx = (B.m_RadLo - A.m_RadLo) * A.Ed; //double dy = (B.m_RadLa - A.m_RadLa) * A.Ec; double BJD = (dx/A.Ed + A.m_RadLo) * 180.0/PI; double BWD = (dy/A.Ec + A.m_RadLa) * 180.0/PI; JWD B=new JWD(BJD, BWD); return B; }
public static double distance1(double longitude1, double latitude1, double longitude2, double latitude2, ref double angle) { JWD A=new JWD(longitude1,latitude1); JWD B=new JWD(longitude2,latitude2); return distance1(ref A, ref B,ref angle); }