PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/MapView/Map/RMFoundation.h

http://github.com/route-me/route-me
C Header | 71 lines | 24 code | 9 blank | 38 comment | 0 complexity | 000a7d9901ce43eb1e507423055597e3 MD5 | raw file
 1//
 2//  RMFoundation.h
 3//
 4// Copyright (c) 2008-2009, Route-Me Contributors
 5// All rights reserved.
 6//
 7// Redistribution and use in source and binary forms, with or without
 8// modification, are permitted provided that the following conditions are met:
 9//
10// * Redistributions of source code must retain the above copyright notice, this
11//   list of conditions and the following disclaimer.
12// * Redistributions in binary form must reproduce the above copyright notice,
13//   this list of conditions and the following disclaimer in the documentation
14//   and/or other materials provided with the distribution.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26// POSSIBILITY OF SUCH DAMAGE.
27
28#import <stdbool.h>
29
30/*! \struct RMProjectedPoint 
31 \brief coordinates, in projected meters, paralleling CGPoint */
32typedef struct {
33	double easting, northing;
34} RMProjectedPoint;
35
36/*! \struct RMProjectedSize 
37 \brief width/height struct, in projected meters, paralleling CGSize */
38typedef struct {
39	double width, height;
40} RMProjectedSize;
41
42/*! \struct RMProjectedRect 
43 \brief location and size, in projected meters, paralleling CGRect */
44typedef struct {
45	RMProjectedPoint origin;
46	RMProjectedSize size;
47} RMProjectedRect;
48
49/// \brief The function checks whether two passed projected points are equal.
50bool RMProjectedPointEqualToProjectedPoint(RMProjectedPoint point1, RMProjectedPoint point2);
51/// \brief The fuction returns true if the passed sizes are equal 
52bool RMProjectedSizeEqualToProjectedSize(RMProjectedSize size1, RMProjectedSize size2);
53/// \brief The fuction returns true if the passed rects are equal 
54bool RMProjectedRectEqualToProjectedRect(RMProjectedRect rect1, RMProjectedRect rect2);
55/// \brief The function returns true if passed rects intersect each other.
56bool RMProjectedRectInterectsProjectedRect(RMProjectedRect rect1, RMProjectedRect rect2);
57
58RMProjectedPoint RMScaleProjectedPointAboutPoint (RMProjectedPoint point, float factor, RMProjectedPoint pivot);
59RMProjectedRect  RMScaleProjectedRectAboutPoint(RMProjectedRect rect,   float factor, RMProjectedPoint pivot);
60RMProjectedPoint RMTranslateProjectedPointBy (RMProjectedPoint point, RMProjectedSize delta);
61RMProjectedRect  RMTranslateProjectedRectBy (RMProjectedRect rect,   RMProjectedSize delta);
62
63RMProjectedPoint RMMakeProjectedPoint (double easting, double northing);
64RMProjectedSize RMMakeProjectedSize(double width, double height); 
65RMProjectedRect RMMakeProjectedRect (double easting, double northing, double width, double height);
66
67/// \brief The function returns the midpoint easting of the given rect.
68double RMProjectedRectGetMidEasting(RMProjectedRect rect);
69
70/// \brief The function returns the midpoint northing of the given rect.
71double RMProjectedRectGetMidNorthing(RMProjectedRect rect);