1 /* === S I N F G =========================================================== */
2 /*! \file layer_polygon.cpp
3 ** \brief Template Header
5 ** $Id: layer_polygon.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "layer_polygon.h"
35 #include "paramdesc.h"
39 #include "valuenode.h"
40 //#include "ETL/bezier"
48 /* === U S I N G =========================================================== */
50 using namespace sinfg;
54 /* === G L O B A L S ======================================================= */
56 SINFG_LAYER_INIT(Layer_Polygon);
57 SINFG_LAYER_SET_NAME(Layer_Polygon,"polygon");
58 SINFG_LAYER_SET_LOCAL_NAME(Layer_Polygon,_("Polygon"));
59 SINFG_LAYER_SET_CATEGORY(Layer_Polygon,_("Geometry"));
60 SINFG_LAYER_SET_VERSION(Layer_Polygon,"0.1");
61 SINFG_LAYER_SET_CVS_ID(Layer_Polygon,"$Id: layer_polygon.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $");
63 /* === C L A S S E S ======================================================= */
65 /* === M E T H O D S ======================================================= */
67 Layer_Polygon::Layer_Polygon():
68 Layer_Shape (1.0,Color::BLEND_COMPOSITE),
71 vector_list.push_back(Point(0,0.5));
72 vector_list.push_back(Point(-0.333333,0));
73 vector_list.push_back(Point(0.333333,0));
77 Layer_Polygon::~Layer_Polygon()
85 int i,pointcount=vector_list.size();
90 //Layer_Shape::clear();
94 move_to(vector_list[0][0],vector_list[0][1]);
96 for(i = 1;i < pointcount; i++)
98 if(isnan(vector_list[i][0]) || isnan(vector_list[i][1]))
100 line_to(vector_list[i][0],vector_list[i][1]);
108 Layer_Polygon::add_polygon(const vector<Point> &point_list)
110 int i,pointcount=point_list.size();
115 //Layer_Shape::clear();
119 move_to(point_list[0][0],point_list[0][1]);
121 for(i = 1;i < pointcount; i++)
123 if(isnan(point_list[i][0]) || isnan(point_list[i][1]))
125 line_to(point_list[i][0],point_list[i][1]);
132 Layer_Polygon::clear()
134 Layer_Shape::clear();
139 Layer_Polygon::set_param(const String & param, const ValueBase &value)
141 if( param=="vector_list" && value.same_as(vector_list))
144 Layer_Shape::clear();
150 return Layer_Shape::set_param(param,value);
154 Layer_Polygon::get_param(const String ¶m)const
161 return Layer_Shape::get_param(param);
165 Layer_Polygon::get_param_vocab()const
167 Layer::Vocab ret(Layer_Shape::get_param_vocab());
169 ret.push_back(ParamDesc("vector_list")
170 .set_local_name(_("Vector List"))
171 .set_origin("offset")