~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina5/tina-libs/tina/geometry/geomGen_props.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  * 
  3  * This file is part of the TINA Open Source Image Analysis Environment
  4  * henceforth known as TINA
  5  *
  6  * TINA is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU Lesser General Public License as 
  8  * published by the Free Software Foundation.
  9  *
 10  * TINA is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser General Public License
 16  * along with TINA; if not, write to the Free Software Foundation, Inc., 
 17  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  *
 19  **********
 20  * 
 21  * Program :    TINA
 22  * File    :  $Source: /home/tina/cvs/tina-libs/tina/geometry/geomGen_props.c,v $
 23  * Date    :  $Date: 2002/12/09 11:51:23 $
 24  * Version :  $Revision: 1.1.1.1 $
 25  * CVS Id  :  $Id: geomGen_props.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
 26  *
 27  * Notes :
 28  *
 29  *********
 30 */
 31 
 32 
 33 #include "geomGen_props.h"
 34 
 35 #if HAVE_CONFIG_H
 36   #include <config.h>
 37 #endif
 38 
 39 #include <tina/sys/sysDef.h>
 40 #include <tina/sys/sysPro.h>
 41 #include <tina/math/mathDef.h>
 42 #include <tina/math/mathPro.h>
 43 #include <tina/geometry/geomDef.h>
 44 #include <tina/geometry/geom_PointDef.h>
 45 #include <tina/geometry/geom_LineDef.h>
 46 #include <tina/geometry/geom_LinePro.h>
 47 #include <tina/geometry/geom_CurveDef.h>
 48 #include <tina/geometry/geom_CurvePro.h>
 49 #include <tina/geometry/geom_PlaneDef.h>
 50 
 51 
 52 void   *geom_prop_get(void *p, int type, int prop)
 53 {
 54     switch (type)
 55     {
 56         case SCALAR:
 57         return (prop_get(((Scalar *) p)->props, prop));
 58     case POINT2:
 59         return (prop_get(((Point2 *) p)->props, prop));
 60     case LINE2:
 61         return (prop_get(((Line2 *) p)->props, prop));
 62     case CONIC2:
 63         return (prop_get(((Conic *) p)->props, prop));
 64     case POINT3:
 65         return (prop_get(((Point3 *) p)->props, prop));
 66     case LINE3:
 67         return (prop_get(((Line3 *) p)->props, prop));
 68     case CONIC3:
 69         {
 70             Conic3 *con3 = p;
 71 
 72             if (con3->conic == NULL)
 73                 return (NULL);
 74             return (prop_get(con3->conic->props, prop));
 75         }
 76     case PLANE:
 77         return (prop_get(((Plane *) p)->props, prop));
 78     case TRANSF3:
 79         return (prop_get(((Transf3 *) p)->props, prop));
 80     }
 81     return (NULL);
 82 }
 83 
 84 void   *geom_prop_update_get(void *p, int *type, int prop)
 85 {
 86     int     stype = *type;
 87 
 88     /* BUGFIX JB 22/11/93 was    *type - prop; */
 89     *type = prop;
 90     switch (stype)
 91     {
 92     case SCALAR:
 93         return (prop_get(((Scalar *) p)->props, prop));
 94     case POINT2:
 95         return (prop_get(((Point2 *) p)->props, prop));
 96     case LINE2:
 97         return (prop_get(((Line2 *) p)->props, prop));
 98     case CONIC2:
 99         return (prop_get(((Conic *) p)->props, prop));
100     case POINT3:
101         return (prop_get(((Point3 *) p)->props, prop));
102     case LINE3:
103         return (prop_get(((Line3 *) p)->props, prop));
104     case CONIC3:
105         {
106             Conic3 *con3 = p;
107 
108             if (con3->conic == NULL)
109                 return (NULL);
110             return (prop_get(con3->conic->props, prop));
111         }
112     case PLANE:
113         return (prop_get(((Plane *) p)->props, prop));
114     case TRANSF3:
115         return (prop_get(((Transf3 *) p)->props, prop));
116     }
117     return (NULL);
118 }
119 
120 void    geom_prop_add(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ))
121 {
122     switch (type)
123     {
124         case SCALAR:
125         {
126             Scalar *s = (Scalar *) geom;
127 
128             s->props = proplist_add(s->props, (void *) prop, prop_type, freefunc);
129             break;
130         }
131     case POINT2:
132         {
133             Point2 *p = (Point2 *) geom;
134 
135             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
136             break;
137         }
138     case LINE2:
139         {
140             Line2  *l = (Line2 *) geom;
141 
142             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
143             break;
144         }
145     case CONIC2:
146         {
147             Conic  *c = (Conic *) geom;
148 
149             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
150             break;
151         }
152     case POINT3:
153         {
154             Point3 *p = (Point3 *) geom;
155 
156             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
157             break;
158         }
159     case LINE3:
160         {
161             Line3  *l = (Line3 *) geom;
162 
163             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
164             break;
165         }
166     case CONIC3:
167         {
168             Conic  *c;
169 
170             if (((Conic3 *) geom)->conic == NULL)
171                 break;
172             c = ((Conic3 *) geom)->conic;
173             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
174             break;
175         }
176     case PLANE:
177         {
178             Plane  *p = (Plane *) geom;
179 
180             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
181             break;
182         }
183     case TRANSF3:
184         {
185             Transf3 *t = (Transf3 *) geom;
186 
187             t->props = proplist_add(t->props, (void *) prop, prop_type, freefunc);
188             break;
189         }
190     }
191 }
192 
193 void    geom_prop_addifnp(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ), Bool dofree)
194 {
195     switch (type)
196     {
197         case SCALAR:
198         {
199             Scalar *s = (Scalar *) geom;
200 
201             s->props = proplist_addifnp(s->props, (void *) prop, prop_type, freefunc, dofree);
202             break;
203         }
204     case POINT2:
205         {
206             Point2 *p = (Point2 *) geom;
207 
208             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
209             break;
210         }
211     case LINE2:
212         {
213             Line2  *l = (Line2 *) geom;
214 
215             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
216             break;
217         }
218     case CONIC2:
219         {
220             Conic  *c = (Conic *) geom;
221 
222             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
223             break;
224         }
225     case POINT3:
226         {
227             Point3 *p = (Point3 *) geom;
228 
229             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
230             break;
231         }
232     case LINE3:
233         {
234             Line3  *l = (Line3 *) geom;
235 
236             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
237             break;
238         }
239     case CONIC3:
240         {
241             Conic  *c;
242 
243             if (((Conic3 *) geom)->conic == NULL)
244                 break;
245             c = ((Conic3 *) geom)->conic;
246             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
247             break;
248         }
249     case PLANE:
250         {
251             Plane  *p = (Plane *) geom;
252 
253             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
254             break;
255         }
256     case TRANSF3:
257         {
258             Transf3 *t = (Transf3 *) geom;
259 
260             t->props = proplist_addifnp(t->props, (void *) prop, prop_type, freefunc, dofree);
261             break;
262         }
263     }
264 }
265 
266 void    geom_add_image_pos_prop(void *geom, int type, Mat3 * rect)
267 {
268     switch (type)
269     {
270         case LINE2:
271         {
272             Line2  *line;
273             Line2  *imline;
274 
275             line = (Line2 *) geom;
276             imline = line2_rectify(line, *rect);
277             line->props = proplist_addifnp(line->props, (void *) imline,
278                                IMPOS, (void (*) ()) line2_free, true);
279             break;
280         }
281     case CONIC2:
282         {
283             Conic  *conic;
284             Conic  *imcon;
285 
286             conic = (Conic *) geom;
287             imcon = conic_rectify(conic, *rect);
288             conic->props = proplist_addifnp(conic->props, (void *) imcon,
289                                IMPOS, (void (*) ()) conic_free, true);
290             break;
291         }
292     }
293 }
294 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.