Visual Servoing Platform  version 3.6.1 under development (2024-03-28)
vpXmlParserRectOriented Class Reference

#include <visp3/core/vpXmlParserRectOriented.h>

Public Types

enum  vpXmlCodeSequenceType { SEQUENCE_OK , SEQUENCE_ERROR }
 

Public Member Functions

 vpXmlParserRectOriented ()
 
 ~vpXmlParserRectOriented ()
 
vpRectOriented getRectangle () const
 
void parse (const std::string &filename)
 
void save (const std::string &filename, bool append=false)
 
void setRectangle (const vpRectOriented &rectangle)
 

Detailed Description

XML parser to load and save an oriented rectangle in a file.

The following example shows how to save an oriented rectangle in an xml file:

#include <visp3/core/vpRectOriented.h>
#include <visp3/core/vpXmlParserRectOriented.h>
int main()
{
vpRectOriented rect(vpImagePoint(10, 15), 20, 12, 0.25);
parser.setRectangle(rect);
std::string filename = "myRectangle.xml";
parser.save(filename);
return 0;
}
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82
Defines an oriented rectangle in the plane.
XML parser to load and save an oriented rectangle in a file.
void setRectangle(const vpRectOriented &rectangle)
void save(const std::string &filename, bool append=false)

The following example shows how to read an oriented rectangle from an xml file:

#include <visp3/core/vpRectOriented.h>
#include <visp3/core/vpXmlParserRectOriented.h>
int main()
{
std::string filename = "myRectangle.xml";
parser.parse(filename);
vpRectOriented rect = parser.getRectangle();
return 0;
}
vpRectOriented getRectangle() const
void parse(const std::string &filename)
Warning
This class is only available if pugixml third-party is successfully built.

Definition at line 88 of file vpXmlParserRectOriented.h.

Member Enumeration Documentation

◆ vpXmlCodeSequenceType

Enumerator
SEQUENCE_OK 
SEQUENCE_ERROR 

Definition at line 94 of file vpXmlParserRectOriented.h.

Constructor & Destructor Documentation

◆ vpXmlParserRectOriented()

vpXmlParserRectOriented::vpXmlParserRectOriented ( )

Definition at line 176 of file vpXmlParserRectOriented.cpp.

◆ ~vpXmlParserRectOriented()

vpXmlParserRectOriented::~vpXmlParserRectOriented ( )

Definition at line 178 of file vpXmlParserRectOriented.cpp.

Member Function Documentation

◆ getRectangle()

vpRectOriented vpXmlParserRectOriented::getRectangle ( ) const

Definition at line 202 of file vpXmlParserRectOriented.cpp.

◆ parse()

void vpXmlParserRectOriented::parse ( const std::string &  filename)

Parse the document. The data in the file are stored in the attributes of the child class. This method calls the readMainClass method which has to be implemented for every child class depending on the content to parse.

Parameters
filename: name of the file to parse

Definition at line 188 of file vpXmlParserRectOriented.cpp.

◆ save()

void vpXmlParserRectOriented::save ( const std::string &  filename,
bool  append = false 
)

Save the content of the class in the file given in parameters. The data of the class are in the child class. This method calls the write_main_class method which has to be implemented for every class depending on the data to save.

Parameters
filename: the name of the file used to record the data
append: if true and if the file exists, the data will be added to the data already in the file

Definition at line 200 of file vpXmlParserRectOriented.cpp.

◆ setRectangle()

void vpXmlParserRectOriented::setRectangle ( const vpRectOriented rectangle)

Definition at line 204 of file vpXmlParserRectOriented.cpp.