TechDraw: Replace C cast

This commit is contained in:
marioalexis
2022-06-17 12:14:34 -03:00
committed by Chris Hennes
parent 734dfc47c6
commit d206116c3d
9 changed files with 26 additions and 26 deletions

View File

@@ -489,22 +489,22 @@ void CosmeticEdge::Restore(Base::XMLReader &reader)
std::string temp = reader.getAttribute("value");
m_format.m_color.fromHexString(temp);
reader.readElement("Visible");
m_format.m_visible = (int)reader.getAttributeAsInteger("value")==0?false:true;
m_format.m_visible = reader.getAttributeAsInteger("value") != 0;
reader.readElement("GeometryType");
TechDraw::GeomType gType = (TechDraw::GeomType)reader.getAttributeAsInteger("value");
TechDraw::GeomType gType = static_cast<TechDraw::GeomType>(reader.getAttributeAsInteger("value"));
if (gType == TechDraw::GeomType::GENERIC) {
TechDraw::GenericPtr gen = std::make_shared<TechDraw::Generic> ();
gen->Restore(reader);
gen->occEdge = GeometryUtils::edgeFromGeneric(gen);
m_geometry = (TechDraw::BaseGeomPtr) gen;
m_geometry = gen;
permaStart = gen->getStartPoint();
permaEnd = gen->getEndPoint();
} else if (gType == TechDraw::GeomType::CIRCLE) {
TechDraw::CirclePtr circ = std::make_shared<TechDraw::Circle> ();
circ->Restore(reader);
circ->occEdge = GeometryUtils::edgeFromCircle(circ);
m_geometry = (TechDraw::BaseGeomPtr) circ;
m_geometry = circ;
permaRadius = circ->radius;
permaStart = circ->center;
permaEnd = circ->center;
@@ -512,7 +512,7 @@ void CosmeticEdge::Restore(Base::XMLReader &reader)
TechDraw::AOCPtr aoc = std::make_shared<TechDraw::AOC> ();
aoc->Restore(reader);
aoc->occEdge = GeometryUtils::edgeFromCircleArc(aoc);
m_geometry = (TechDraw::BaseGeomPtr) aoc;
m_geometry = aoc;
permaStart = aoc->startPnt;
permaEnd = aoc->endPnt;
permaRadius = aoc->radius;
@@ -1355,7 +1355,7 @@ void CenterLine::Restore(Base::XMLReader &reader)
//stored geometry
reader.readElement("GeometryType");
TechDraw::GeomType gType = (TechDraw::GeomType)reader.getAttributeAsInteger("value");
TechDraw::GeomType gType = static_cast<TechDraw::GeomType>(reader.getAttributeAsInteger("value"));
if (gType == TechDraw::GeomType::GENERIC) {
TechDraw::GenericPtr gen = std::make_shared<TechDraw::Generic> ();
gen->Restore(reader);

View File

@@ -255,19 +255,19 @@ void BaseGeom::Save(Base::Writer &writer) const
void BaseGeom::Restore(Base::XMLReader &reader)
{
reader.readElement("GeomType");
geomType = (TechDraw::GeomType) reader.getAttributeAsInteger("value");
geomType = static_cast<TechDraw::GeomType>(reader.getAttributeAsInteger("value"));
reader.readElement("ExtractType");
extractType = (TechDraw::ExtractionType) reader.getAttributeAsInteger("value");
extractType = static_cast<TechDraw::ExtractionType>(reader.getAttributeAsInteger("value"));
reader.readElement("EdgeClass");
classOfEdge = (TechDraw::edgeClass) reader.getAttributeAsInteger("value");
classOfEdge = static_cast<TechDraw::edgeClass>(reader.getAttributeAsInteger("value"));
reader.readElement("HLRVisible");
hlrVisible = (int)reader.getAttributeAsInteger("value")==0?false:true;
hlrVisible = reader.getAttributeAsInteger("value") != 0;
reader.readElement("Reversed");
reversed = (int)reader.getAttributeAsInteger("value")==0?false:true;
reversed = reader.getAttributeAsInteger("value") != 0;
reader.readElement("Ref3D");
ref3D = reader.getAttributeAsInteger("value");
reader.readElement("Cosmetic");
cosmetic = (int)reader.getAttributeAsInteger("value")==0?false:true;
cosmetic = reader.getAttributeAsInteger("value") != 0;
reader.readElement("Source");
m_source = reader.getAttributeAsInteger("value");
reader.readElement("SourceIndex");
@@ -1610,15 +1610,15 @@ void Vertex::Restore(Base::XMLReader &reader)
pnt.z = reader.getAttributeAsFloat("Z");
reader.readElement("Extract");
extractType = (ExtractionType) reader.getAttributeAsInteger("value");
extractType = static_cast<ExtractionType>(reader.getAttributeAsInteger("value"));
// reader.readElement("Visible");
// hlrVisible = (bool)reader.getAttributeAsInteger("value")==0?false:true;
reader.readElement("Ref3D");
ref3D = reader.getAttributeAsInteger("value");
reader.readElement("IsCenter");
hlrVisible = (bool)reader.getAttributeAsInteger("value")==0?false:true;
hlrVisible = reader.getAttributeAsInteger("value") != 0;
reader.readElement("Cosmetic");
cosmetic = (bool)reader.getAttributeAsInteger("value")==0?false:true;
cosmetic = reader.getAttributeAsInteger("value") != 0;
reader.readElement("CosmeticLink");
cosmeticLink = reader.getAttributeAsInteger("value");
reader.readElement("CosmeticTag");

View File

@@ -163,7 +163,7 @@ void PropertyCenterLineList::Restore(Base::XMLReader &reader)
for (int i = 0; i < count; i++) {
reader.readElement("CenterLine");
const char* TypeName = reader.getAttribute("type");
CenterLine *newG = (CenterLine *)Base::Type::fromName(TypeName).createInstance();
CenterLine *newG = static_cast<CenterLine *>(Base::Type::fromName(TypeName).createInstance());
newG->Restore(reader);
if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {

View File

@@ -165,7 +165,7 @@ void PropertyCosmeticEdgeList::Restore(Base::XMLReader &reader)
for (int i = 0; i < count; i++) {
reader.readElement("CosmeticEdge");
const char* TypeName = reader.getAttribute("type");
CosmeticEdge *newG = (CosmeticEdge *)Base::Type::fromName(TypeName).createInstance();
CosmeticEdge *newG = static_cast<CosmeticEdge *>(Base::Type::fromName(TypeName).createInstance());
newG->Restore(reader);
if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {

View File

@@ -165,7 +165,7 @@ void PropertyCosmeticVertexList::Restore(Base::XMLReader &reader)
for (int i = 0; i < count; i++) {
reader.readElement("CosmeticVertex");
const char* TypeName = reader.getAttribute("type");
CosmeticVertex *newG = (CosmeticVertex *)Base::Type::fromName(TypeName).createInstance();
CosmeticVertex *newG = static_cast<CosmeticVertex *>(Base::Type::fromName(TypeName).createInstance());
newG->Restore(reader);
if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {

View File

@@ -177,7 +177,7 @@ void PropertyGeomFormatList::Restore(Base::XMLReader &reader)
for (int i = 0; i < count; i++) {
reader.readElement("GeomFormat");
const char* TypeName = reader.getAttribute("type");
GeomFormat *newG = (GeomFormat *)Base::Type::fromName(TypeName).createInstance();
GeomFormat *newG = static_cast<GeomFormat *>(Base::Type::fromName(TypeName).createInstance());
newG->Restore(reader);
if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {

View File

@@ -365,8 +365,8 @@ void QGILeaderLine::draw()
setFlag(QGraphicsItem::ItemIsMovable, false);
else
setFlag(QGraphicsItem::ItemIsMovable, true);
m_lineStyle = (Qt::PenStyle) vp->LineStyle.getValue();
m_lineStyle = static_cast<Qt::PenStyle>(vp->LineStyle.getValue());
double baseScale = featLeader->getBaseScale();
double x = Rez::guiX(featLeader->X.getValue());
double y = - Rez::guiX(featLeader->Y.getValue());

View File

@@ -226,7 +226,7 @@ void QGIPrimPath::setStyle(Qt::PenStyle s)
void QGIPrimPath::setStyle(int s)
{
// Base::Console().Message("QGIPP::setStyle(int: %d)\n", s);
m_styleCurrent = (Qt::PenStyle) s;
m_styleCurrent = static_cast<Qt::PenStyle>(s);
}
@@ -260,16 +260,16 @@ Qt::PenCapStyle QGIPrimPath::prefCapStyle()
newStyle = hGrp->GetInt("EdgeCapStyle", 32); //0x00 FlatCap, 0x10 SquareCap, 0x20 RoundCap
switch (newStyle) {
case 0:
result = (Qt::PenCapStyle) 0x20; //round;
result = static_cast<Qt::PenCapStyle>(0x20); //round;
break;
case 1:
result = (Qt::PenCapStyle) 0x10; //square;
result = static_cast<Qt::PenCapStyle>(0x10); //square;
break;
case 2:
result = (Qt::PenCapStyle) 0x00; //flat
result = static_cast<Qt::PenCapStyle>(0x00); //flat
break;
default:
result = (Qt::PenCapStyle) 0x20;
result = static_cast<Qt::PenCapStyle>(0x20);
}
return result;
}

View File

@@ -304,7 +304,7 @@ QPen QGIRichAnno::rectPen() const
return pen;
double rectWeight = Rez::guiX(vp->LineWidth.getValue());
Qt::PenStyle rectStyle = (Qt::PenStyle) vp->LineStyle.getValue();
Qt::PenStyle rectStyle = static_cast<Qt::PenStyle>(vp->LineStyle.getValue());
App::Color temp = vp->LineColor.getValue();
QColor rectColor = temp.asValue<QColor>();