/[zanavi_public1]/navit/navit/maptool/refine/pslg.h
ZANavi

Contents of /navit/navit/maptool/refine/pslg.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Mon Feb 4 17:41:59 2013 UTC (11 years, 2 months ago) by zoff99
File MIME type: text/plain
File size: 4453 byte(s)
new map version, lots of fixes and experimental new features
1 /*
2 * This file is a part of Poly2Tri-C
3 * (c) Barak Itkin <lightningismyname@gmail.com>
4 * http://code.google.com/p/poly2tri-c/
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without modification,
9 * are permitted provided that the following conditions are met:
10 *
11 * * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * * Neither the name of Poly2Tri nor the names of its contributors may be
17 * used to endorse or promote products derived from this software without specific
18 * prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef __P2TC_REFINE_PSLG_H__
34 #define __P2TC_REFINE_PSLG_H__
35
36 #include "utils.h"
37 #include "vector2.h"
38 #include "line.h"
39 #include "bounded-line.h"
40
41 typedef P2trHashSet P2trPSLG;
42 typedef P2trHashSetIter P2trPSLGIter;
43
44 /**
45 * Create a new PSLG. After finishing to use this PSLG, it should be
46 * freed by calling @ref p2tr_pslg_free
47 * @return A new empty PSLG
48 */
49 P2trPSLG* p2tr_pslg_new (void);
50
51 /**
52 * Add a new line to the PSLG, where the line is defined by two given
53 * points.
54 * @param[in] pslg The PSLG
55 * @param[in] start The first edge-point of the new line to add
56 * @param[in] end The second edge-point of the new line to add
57 */
58 void p2tr_pslg_add_new_line (P2trPSLG *pslg,
59 const P2trVector2 *start,
60 const P2trVector2 *end);
61
62 /**
63 * Add an existing P2trBoundedLine to the PSLG, so that the line will
64 * not be freed when the PSLG is freed. This line must not be freed
65 * before the PSLG is freed!
66 * @param[in] pslg The PSLG
67 * @param[in] line The existing line to add
68 */
69 void p2tr_pslg_add_existing_line (P2trPSLG *pslg,
70 const P2trBoundedLine *line);
71
72 /**
73 * Count how many lines are there in the PSLG
74 * @param[in] pslg The PSLG
75 * @return The amount of lines in the PSLG
76 */
77 guint p2tr_pslg_size (P2trPSLG *pslg);
78
79 /**
80 * Initialize an iterator to iterate over all the lines of the PSLG. The
81 * iterator will remain valid as long as the PSLG is not modified.
82 * @param[out] iter The iterator for this PSLG
83 * @param[in] pslg The PSLG
84 */
85 void p2tr_pslg_iter_init (P2trPSLGIter *iter,
86 P2trPSLG *pslg);
87
88 /**
89 * Advance the iterator to the next line of the PSLG
90 * @param[in] iter The PSLG iterator
91 * @param[out] line The next line of the PSLG
92 * @return TRUE if there was another line, FALSE if the iteration over
93 * all the lines was finished
94 */
95 gboolean p2tr_pslg_iter_next (P2trPSLGIter *iter,
96 const P2trBoundedLine **line);
97
98 /**
99 * Test whether the PSLG contains this line. The line comparision is
100 * done *by refrence* and not by value, so this function only test if
101 * the line at the given memory location is inside the PSLG.
102 * @param[in] pslg The PSLG
103 * @param[in] line The line to search for
104 * @return TRUE if the line was found in the PSLG, FALSE otherwise
105 */
106 gboolean p2tr_pslg_contains_line (P2trPSLG *pslg,
107 const P2trBoundedLine *line);
108
109 /**
110 * Free a PSLG and all of the resources allocated for it
111 * @param[in] pslg The PSLG to free
112 */
113 void p2tr_pslg_free (P2trPSLG *pslg);
114
115 #endif

   
Visit the ZANavi Wiki