remove superfluous FillType enum

This commit is contained in:
wmayer
2017-04-15 19:32:49 +02:00
parent f96d374250
commit 5689e4c13b
8 changed files with 25 additions and 81 deletions

View File

@@ -33,7 +33,6 @@ SET(Surface_SRCS
FeatureBezierSurface.h
FeatureBSplineSurface.cpp
FeatureBSplineSurface.h
FillType.h
)
link_directories(${OCC_LIBRARY_DIR})

View File

@@ -57,8 +57,6 @@ BSplineSurface::BSplineSurface() : SurfaceFeature()
App::DocumentObjectExecReturn *BSplineSurface::execute(void)
{
correcteInvalidFillType();
try{
std::vector<Handle_Geom_BSplineCurve> crvs;
crvs.reserve(4);

View File

@@ -54,8 +54,6 @@ BezierSurface::BezierSurface() : SurfaceFeature()
App::DocumentObjectExecReturn *BezierSurface::execute(void)
{
correcteInvalidFillType();
try {
std::vector<Handle_Geom_BezierCurve> crvs;
crvs.reserve(4);

View File

@@ -150,7 +150,7 @@ void ShapeValidator::checkAndAdd(const Part::TopoShape &ts, const char *subName,
PROPERTY_SOURCE(Surface::SurfaceFeature, Part::Feature)
const char* SurfaceFeature::FillTypeEnums[] = {"Invalid", "Stretched", "Coons", "Curved", NULL};
const char* SurfaceFeature::FillTypeEnums[] = {"Stretched", "Coons", "Curved", NULL};
SurfaceFeature::SurfaceFeature(): Feature()
{
@@ -174,19 +174,17 @@ short SurfaceFeature::mustExecute() const
GeomFill_FillingStyle SurfaceFeature::getFillingStyle()
{
//Identify filling style
int ftype = FillType.getValue();
if (ftype==StretchStyle)
return GeomFill_StretchStyle;
else if(ftype==CoonsStyle)
return GeomFill_CoonsStyle;
else if(ftype==CurvedStyle)
return GeomFill_CurvedStyle;
else
Standard_Failure::Raise("Filling style must be 1 (Stretch), 2 (Coons), or 3 (Curved).");
throw; // this is to shut up the compiler
switch (FillType.getValue()) {
case GeomFill_StretchStyle:
case GeomFill_CoonsStyle:
case GeomFill_CurvedStyle:
return static_cast<GeomFill_FillingStyle>(FillType.getValue());
default:
Standard_Failure::Raise("Filling style must be 0 (Stretch), 1 (Coons), or 2 (Curved).\n");
throw; // this is to shut up the compiler
}
}
void SurfaceFeature::getWire(TopoDS_Wire& aWire)
{
Handle(ShapeFix_Wire) aShFW = new ShapeFix_Wire;
@@ -214,7 +212,7 @@ void SurfaceFeature::getWire(TopoDS_Wire& aWire)
}
if (validator.numEdges() < 2 || validator.numEdges() > 4) {
Standard_Failure::Raise("Only 2-4 curves are allowed");
Standard_Failure::Raise("Only 2-4 curves are allowed\n");
}
//Reorder the curves and fix the wire if required
@@ -251,12 +249,3 @@ void SurfaceFeature::createFace(const Handle_Geom_BoundedSurface &aSurface)
}
this->Shape.setValue(aFace);
}
void SurfaceFeature::correcteInvalidFillType()
{
int ftype = FillType.getValue();
if(ftype == InvalidStyle)
{
FillType.setValue(StretchStyle);
}
}

View File

@@ -32,7 +32,6 @@
#include <App/PropertyUnits.h>
#include <App/PropertyLinks.h>
#include <Mod/Part/App/PartFeature.h>
#include <Mod/Surface/App/FillType.h>
namespace Surface
{
@@ -83,9 +82,6 @@ protected:
void getWire(TopoDS_Wire& aWire);
void createFace(const Handle_Geom_BoundedSurface &aSurface);
// corrects the initially invalid fill type
void correcteInvalidFillType();
private:
static const char* FillTypeEnums[];
};

View File

@@ -1,35 +0,0 @@
/***************************************************************************
* Copyright (c) 2015 Balázs Bámer *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef SURFACE_FILLTYPE_H
#define SURFACE_FILLTYPE_H
enum FillType_t
{
InvalidStyle = 0,
StretchStyle,
CoonsStyle,
CurvedStyle
};
#endif // SURAFCE_FILLTYPE_H

View File

@@ -25,8 +25,8 @@
#include <QAction>
#include <QMenu>
#include <QMessageBox>
#include <GeomFill_FillingStyle.hxx>
#include <Mod/Surface/App/FillType.h>
#include <Gui/ViewProvider.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
@@ -149,16 +149,16 @@ SurfaceFilling::~SurfaceFilling()
void SurfaceFilling::setEditedObject(Surface::SurfaceFeature* obj)
{
editedObject = obj;
long curtype = editedObject->FillType.getValue();
GeomFill_FillingStyle curtype = static_cast<GeomFill_FillingStyle>(editedObject->FillType.getValue());
switch(curtype)
{
case 1: // StretchStyle
case GeomFill_StretchStyle:
ui->fillType_stretch->setChecked(true);
break;
case 2: // CoonsStyle
case GeomFill_CoonsStyle:
ui->fillType_coons->setChecked(true);
break;
case 3: // CurvedStyle
case GeomFill_CurvedStyle:
ui->fillType_curved->setChecked(true);
break;
default:
@@ -265,9 +265,9 @@ bool SurfaceFilling::reject()
void SurfaceFilling::on_fillType_stretch_clicked()
{
long curtype = editedObject->FillType.getValue();
if (curtype != 1) {
editedObject->FillType.setValue(1);
GeomFill_FillingStyle curtype = static_cast<GeomFill_FillingStyle>(editedObject->FillType.getValue());
if (curtype != GeomFill_StretchStyle) {
editedObject->FillType.setValue(static_cast<long>(GeomFill_StretchStyle));
editedObject->recomputeFeature();
if (!editedObject->isValid()) {
Base::Console().Error("Surface filling: %s", editedObject->getStatusString());
@@ -277,9 +277,9 @@ void SurfaceFilling::on_fillType_stretch_clicked()
void SurfaceFilling::on_fillType_coons_clicked()
{
long curtype = editedObject->FillType.getValue();
if (curtype != 2) {
editedObject->FillType.setValue(2);
GeomFill_FillingStyle curtype = static_cast<GeomFill_FillingStyle>(editedObject->FillType.getValue());
if (curtype != GeomFill_CoonsStyle) {
editedObject->FillType.setValue(static_cast<long>(GeomFill_CoonsStyle));
editedObject->recomputeFeature();
if (!editedObject->isValid()) {
Base::Console().Error("Surface filling: %s", editedObject->getStatusString());
@@ -289,9 +289,9 @@ void SurfaceFilling::on_fillType_coons_clicked()
void SurfaceFilling::on_fillType_curved_clicked()
{
long curtype = editedObject->FillType.getValue();
if (curtype != 3) {
editedObject->FillType.setValue(3);
GeomFill_FillingStyle curtype = static_cast<GeomFill_FillingStyle>(editedObject->FillType.getValue());
if (curtype != GeomFill_CurvedStyle) {
editedObject->FillType.setValue(static_cast<long>(GeomFill_CurvedStyle));
editedObject->recomputeFeature();
if (!editedObject->isValid()) {
Base::Console().Error("Surface filling: %s", editedObject->getStatusString());

View File

@@ -28,7 +28,6 @@
#include <Gui/SelectionFilter.h>
#include <Gui/DocumentObserver.h>
#include <Base/BoundBox.h>
#include <Mod/Surface/App/FillType.h>
#include <Mod/Part/Gui/ViewProviderSpline.h>
#include <Mod/Surface/App/FeatureSurface.h>