geom/src/CurveCreator/CurveCreator_ICurve.hxx

207 lines
6.6 KiB
C++
Raw Normal View History

// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
2013-10-30 22:50:50 +06:00
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
2013-10-30 22:50:50 +06:00
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: CurveCreator_ICurve.hxx
// Author: Alexander KOVALEV and Alexander SOLOVYOV
2013-10-30 22:50:50 +06:00
#ifndef _CurveCreator_ICurve_HeaderFile
#define _CurveCreator_ICurve_HeaderFile
#include "CurveCreator_Macro.hxx"
#include <deque>
#include <vector>
#include <string>
#include <list>
2013-10-30 22:50:50 +06:00
class Handle_AIS_InteractiveObject;
namespace CurveCreator
{
//! Type of the section
enum SectionType
{
Polyline,
Spline,
};
//! Dimension of the curve
enum Dimension
{
Dim2d = 2,
Dim3d = 3
};
};
2013-10-30 22:50:50 +06:00
/**
* The CurveCreator_ICurve object is represented as one or more sets of
* connected points; thus CurveCreator_ICurve object can contain several
* not connected curves (polylines or b-splines), each such curve has two
* only ends "start and end points" in other words non-manifold curves
2013-10-30 22:50:50 +06:00
* are not supported.
*/
class CURVECREATOR_EXPORT CurveCreator_ICurve
{
public:
typedef std::pair<int,int> SectionToPoint;
typedef std::deque<SectionToPoint> SectionToPointList;
2013-10-30 22:50:50 +06:00
typedef std::deque< std::pair< SectionToPoint,std::deque< float > > > SectionToPointCoordsList;
2013-10-30 22:50:50 +06:00
public:
/***********************************************/
/*** Undo/Redo methods ***/
/***********************************************/
2013-10-30 22:50:50 +06:00
//! Get number of available undo operations
virtual int getNbUndo() const = 0;
2013-10-30 22:50:50 +06:00
//! Undo previous operation
virtual bool undo() = 0;
2013-10-30 22:50:50 +06:00
//! Get number of available redo operations
virtual int getNbRedo() const = 0;
2013-10-30 22:50:50 +06:00
//! Redo last previously "undone" operation
virtual bool redo() = 0;
2013-10-30 22:50:50 +06:00
/***********************************************/
/*** Section methods ***/
/***********************************************/
2013-10-30 22:50:50 +06:00
//! Clear the polyline (remove all sections)
virtual bool clear() = 0;
2013-10-30 22:50:50 +06:00
//! Join list of sections to one section (join all if the list is empty)
// The first section in the list is a leader, another sections are joined to it
virtual bool join( const std::list<int>& theSections ) = 0;
2013-10-30 22:50:50 +06:00
//! Get number of sections
virtual int getNbSections() const = 0;
2013-10-30 22:50:50 +06:00
//! Add a new section.
virtual int addSection( const std::string& theName,
const CurveCreator::SectionType theType,
const bool theIsClosed ) = 0;
2013-10-30 22:50:50 +06:00
//! Removes the given sections.
virtual bool removeSection( const int theISection ) = 0;
2013-10-30 22:50:50 +06:00
//! Get "closed" flag of the specified section
virtual bool isClosed( const int theISection ) const = 0;
2013-10-30 22:50:50 +06:00
/**
* Set "closed" flag of the specified section (all sections if
* \a theISection is -1).
2013-10-30 22:50:50 +06:00
*/
virtual bool setClosed( const int theISection,
const bool theIsClosed ) = 0;
2013-10-30 22:50:50 +06:00
//! Returns specifyed section name
virtual std::string getSectionName( const int theISection ) const = 0;
2013-10-30 22:50:50 +06:00
/** Set name of the specified section */
virtual bool setSectionName( const int theISection,
const std::string& theName ) = 0;
2013-10-30 22:50:50 +06:00
//! Get type of the specified section
virtual CurveCreator::SectionType getSectionType( const int theISection ) const = 0;
/**
* Set type of the specified section (or all sections
2013-10-30 22:50:50 +06:00
* if \a theISection is -1).
*/
virtual bool setSectionType( const int theISection,
const CurveCreator::SectionType theType ) = 0;
2013-10-30 22:50:50 +06:00
/***********************************************/
/*** Point methods ***/
/***********************************************/
2013-10-30 22:50:50 +06:00
//! Get the dimension.
virtual CurveCreator::Dimension getDimension() const = 0;
2013-10-30 22:50:50 +06:00
/**
* Insert one or several points to the specified section starting from the given theIPnt index
* (or add these at the end of section points if \a theIPnt is -1).
2013-10-30 22:50:50 +06:00
*/
virtual bool addPoints( const std::deque<float>& theCoords,
const int theISection,
const int theIPnt = -1 ) = 0;
2013-10-30 22:50:50 +06:00
//! Set coordinates of specified point
virtual bool setPoint( const int theISection,
const int theIPnt,
const std::deque<float>& theNewCoords ) = 0;
//! Set coordinates of specified points from different sections
virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
const bool theIsToSaveDiff = true ) = 0;
//! Remove point with given id
virtual bool removePoint( const int theISection, const int theIPnt = -1 ) = 0;
//! Remove several points from different sections
virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0;
2013-10-30 22:50:50 +06:00
//! Get coordinates of specified point
virtual std::deque<float> getPoint( const int theISection,
const int theIPnt ) const = 0;
2013-10-30 22:50:50 +06:00
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
2013-10-30 22:50:50 +06:00
*/
virtual std::deque<float> getPoints( const int theISection = -1 ) const = 0;
2013-10-30 22:50:50 +06:00
/**
* Get number of points in specified section or (the total number of points
* in Curve if theISection is equal to -1).
2013-10-30 22:50:50 +06:00
*/
virtual int getNbPoints( const int theISection ) const = 0;
2013-10-30 22:50:50 +06:00
/**
* Set skip sorting flag. If the flag is true - points sorting will be skipped.
*/
virtual void setSkipSorting( const bool ) = 0;
2013-10-30 22:50:50 +06:00
/**
* Indicates whether the points can be sorted.
*/
virtual bool canPointsBeSorted() = 0;
2013-10-30 22:50:50 +06:00
/**
* Saves points coordinates difference.
* \param theOldCoords the old points coordinates
2013-10-30 22:50:50 +06:00
*/
virtual void saveCoordDiff( const SectionToPointCoordsList &theOldCoords ) = 0;
2013-10-30 22:50:50 +06:00
/***********************************************/
/*** Presentation methods ***/
/***********************************************/
2013-10-30 22:50:50 +06:00
virtual Handle_AIS_InteractiveObject getAISObject( const bool theNeedToBuild = false ) const = 0;
protected:
virtual void constructAISObject() = 0;
2013-10-30 22:50:50 +06:00
};
#endif