tmxparser  2.1.0
 All Classes Functions Variables Pages
TmxPolyline.h
1 //-----------------------------------------------------------------------------
2 // TmxPolyline.h
3 //
4 // Copyright (c) 2010-2014, Tamir Atias
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 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
19 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Author: Tamir Atias
27 //-----------------------------------------------------------------------------
28 #pragma once
29 
30 #include <vector>
31 
32 #include "TmxPoint.h"
33 
34 namespace tinyxml2 {
35  class XMLNode;
36 }
37 
38 namespace Tmx
39 {
40  //-------------------------------------------------------------------------
42  //-------------------------------------------------------------------------
43  class Polyline
44  {
45  public:
46  Polyline();
47 
49  void Parse(const tinyxml2::XMLNode *polylineNode);
50 
52  const Tmx::Point &GetPoint(int index) const { return points[index]; }
53 
55  int GetNumPoints() const { return points.size(); }
56 
57  private:
58  std::vector< Tmx::Point > points;
59  };
60 }
void Parse(const tinyxml2::XMLNode *polylineNode)
Parse the polyline node.
Definition: TmxPolyline.cpp:40
const Tmx::Point & GetPoint(int index) const
Get one of the vertices.
Definition: TmxPolyline.h:52
Class to store a Polyline of an Object.
Definition: TmxPolyline.h:43
Used to store a vertex of a Polygon/Polyline.
Definition: TmxPoint.h:35
int GetNumPoints() const
Get the number of vertices.
Definition: TmxPolyline.h:55