|
|
|
@ -62,7 +62,7 @@
|
|
|
|
|
struct DrGeoHierarchyElement
|
|
|
|
|
{
|
|
|
|
|
TQString id;
|
|
|
|
|
std::vector<TQString> tqparents;
|
|
|
|
|
std::vector<TQString> parents;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
KigFilterDrgeo::KigFilterDrgeo()
|
|
|
|
@ -202,7 +202,7 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
TQDomElement ce = c.toElement();
|
|
|
|
|
if ( ce.isNull() ) continue;
|
|
|
|
|
else if ( ce.tagName() == "tqparent" )
|
|
|
|
|
elem.tqparents.push_back( ce.attribute( "ref" ) );
|
|
|
|
|
elem.parents.push_back( ce.attribute( "ref" ) );
|
|
|
|
|
}
|
|
|
|
|
TQString curid = domelem.attribute( "id" );
|
|
|
|
|
elem.id = !curid.isNull() ? curid : TQString::number( withoutid++ ) ;
|
|
|
|
@ -216,9 +216,9 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
for ( uint i = 0; i < elems.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
x = "";
|
|
|
|
|
for ( uint j = 0; j < elems[i].tqparents.size(); ++j )
|
|
|
|
|
for ( uint j = 0; j < elems[i].parents.size(); ++j )
|
|
|
|
|
{
|
|
|
|
|
x += elems[i].tqparents[j] + "_";
|
|
|
|
|
x += elems[i].parents[j] + "_";
|
|
|
|
|
}
|
|
|
|
|
kdDebug() << " --> " << i << " - " << elems[i].id << " - " << x << endl;
|
|
|
|
|
}
|
|
|
|
@ -241,25 +241,25 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
kdDebug() << "+++ id: " << curid << endl;
|
|
|
|
|
#endif
|
|
|
|
|
const DrGeoHierarchyElement& el = elems[curid];
|
|
|
|
|
std::vector<ObjectCalcer*> tqparents;
|
|
|
|
|
for ( uint j = 0; j < el.tqparents.size(); ++j )
|
|
|
|
|
std::vector<ObjectCalcer*> parents;
|
|
|
|
|
for ( uint j = 0; j < el.parents.size(); ++j )
|
|
|
|
|
{
|
|
|
|
|
int tqparentid = convertDrgeoIndex( elems, el.tqparents[j] );
|
|
|
|
|
if ( tqparentid == -1 )
|
|
|
|
|
int parentid = convertDrgeoIndex( elems, el.parents[j] );
|
|
|
|
|
if ( parentid == -1 )
|
|
|
|
|
KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
tqparents.push_back( holders[tqparentid-nignored]->calcer() );
|
|
|
|
|
parents.push_back( holders[parentid-nignored]->calcer() );
|
|
|
|
|
};
|
|
|
|
|
TQDomElement domelem = a.toElement();
|
|
|
|
|
|
|
|
|
|
#ifdef DRGEO_DEBUG
|
|
|
|
|
if ( tqparents.size() > 0 )
|
|
|
|
|
for ( uint j = 0; j < tqparents.size(); ++j )
|
|
|
|
|
if ( parents.size() > 0 )
|
|
|
|
|
for ( uint j = 0; j < parents.size(); ++j )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "+++++++++ tqparent[" << j << "]: " << tqparents[j] << " - "
|
|
|
|
|
<< tqparents[j]->imp()->type()->internalName() << endl;
|
|
|
|
|
kdDebug() << "+++++++++ tqparent[" << j << "]: " << parents[j] << " - "
|
|
|
|
|
<< parents[j]->imp()->type()->internalName() << endl;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
kdDebug() << "+++++++++ tqparents: NO" << endl;
|
|
|
|
|
kdDebug() << "+++++++++ parents: NO" << endl;
|
|
|
|
|
kdDebug() << "+++++++++ " << domelem.tagName() << " - " << domelem.attribute("type") << endl;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -291,15 +291,15 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
oc = fact->fixedPointCalcer( Coordinate( x, y ) );
|
|
|
|
|
}
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Middle_2pts" )
|
|
|
|
|
oc = new ObjectTypeCalcer( MidPointType::instance(), tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( MidPointType::instance(), parents );
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Middle_segment" )
|
|
|
|
|
{
|
|
|
|
|
if ( tqparents.size() != 1 ) KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
if ( !tqparents[0]->imp()->inherits( SegmentImp::stype() ) )
|
|
|
|
|
if ( parents.size() != 1 ) KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
if ( !parents[0]->imp()->inherits( SegmentImp::stype() ) )
|
|
|
|
|
KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
ObjectPropertyCalcer* o1 = fact->propertyObjectCalcer( tqparents[0], "end-point-A" );
|
|
|
|
|
ObjectPropertyCalcer* o1 = fact->propertyObjectCalcer( parents[0], "end-point-A" );
|
|
|
|
|
o1->calc( *ret );
|
|
|
|
|
ObjectPropertyCalcer* o2 = fact->propertyObjectCalcer( tqparents[0], "end-point-B" );
|
|
|
|
|
ObjectPropertyCalcer* o2 = fact->propertyObjectCalcer( parents[0], "end-point-B" );
|
|
|
|
|
o2->calc( *ret );
|
|
|
|
|
std::vector<ObjectCalcer*> args;
|
|
|
|
|
args.push_back( o1 );
|
|
|
|
@ -312,26 +312,26 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
double value = values.toDouble( &ok3 );
|
|
|
|
|
if ( ! ok3 )
|
|
|
|
|
KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
if ( ( tqparents[0]->imp()->inherits( CircleImp::stype() ) ) ||
|
|
|
|
|
( tqparents[0]->imp()->inherits( SegmentImp::stype() ) ) )
|
|
|
|
|
oc = fact->constrainedPointCalcer( tqparents[0], value );
|
|
|
|
|
else if ( tqparents[0]->imp()->inherits( LineImp::stype() ) )
|
|
|
|
|
if ( ( parents[0]->imp()->inherits( CircleImp::stype() ) ) ||
|
|
|
|
|
( parents[0]->imp()->inherits( SegmentImp::stype() ) ) )
|
|
|
|
|
oc = fact->constrainedPointCalcer( parents[0], value );
|
|
|
|
|
else if ( parents[0]->imp()->inherits( LineImp::stype() ) )
|
|
|
|
|
{
|
|
|
|
|
const LineData l = static_cast<const LineImp*>( tqparents[0]->imp() )->data();
|
|
|
|
|
const LineData l = static_cast<const LineImp*>( parents[0]->imp() )->data();
|
|
|
|
|
const Coordinate p = convertDrgeoLineParam( value, l );
|
|
|
|
|
oc = fact->constrainedPointCalcer( tqparents[0], p, *ret );
|
|
|
|
|
oc = fact->constrainedPointCalcer( parents[0], p, *ret );
|
|
|
|
|
}
|
|
|
|
|
else if ( tqparents[0]->imp()->inherits( RayImp::stype() ) )
|
|
|
|
|
else if ( parents[0]->imp()->inherits( RayImp::stype() ) )
|
|
|
|
|
{
|
|
|
|
|
const LineData l = static_cast<const RayImp*>( tqparents[0]->imp() )->data();
|
|
|
|
|
const LineData l = static_cast<const RayImp*>( parents[0]->imp() )->data();
|
|
|
|
|
const Coordinate p = convertDrgeoHalflineParam( value, l );
|
|
|
|
|
oc = fact->constrainedPointCalcer( tqparents[0], p, *ret );
|
|
|
|
|
oc = fact->constrainedPointCalcer( parents[0], p, *ret );
|
|
|
|
|
}
|
|
|
|
|
else if ( tqparents[0]->imp()->inherits( ArcImp::stype() ) )
|
|
|
|
|
oc = fact->constrainedPointCalcer( tqparents[0], 1 - value );
|
|
|
|
|
else if ( parents[0]->imp()->inherits( ArcImp::stype() ) )
|
|
|
|
|
oc = fact->constrainedPointCalcer( parents[0], 1 - value );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// oc = fact->constrainedPointCalcer( tqparents[0], value );
|
|
|
|
|
// oc = fact->constrainedPointCalcer( parents[0], value );
|
|
|
|
|
notSupported( file, i18n( "This Dr. Geo file contains a \"%1 %2\" object, "
|
|
|
|
|
"which Kig does not currently support." ).tqarg( domelem.tagName() ).tqarg(
|
|
|
|
|
domelem.attribute( "type" ) ) );
|
|
|
|
@ -340,9 +340,9 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
}
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Intersection" )
|
|
|
|
|
{
|
|
|
|
|
if ( ( tqparents[0]->imp()->inherits( AbstractLineImp::stype() ) ) &&
|
|
|
|
|
( tqparents[1]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
oc = new ObjectTypeCalcer( LineLineIntersectionType::instance(), tqparents );
|
|
|
|
|
if ( ( parents[0]->imp()->inherits( AbstractLineImp::stype() ) ) &&
|
|
|
|
|
( parents[1]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
oc = new ObjectTypeCalcer( LineLineIntersectionType::instance(), parents );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
@ -351,21 +351,21 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
if ( which == 1 ) which = -1;
|
|
|
|
|
else if ( which == 0 ) which = 1;
|
|
|
|
|
else KIG_FILTER_PARSE_ERROR;
|
|
|
|
|
std::vector<ObjectCalcer*> args = tqparents;
|
|
|
|
|
std::vector<ObjectCalcer*> args = parents;
|
|
|
|
|
const ObjectType* type = 0;
|
|
|
|
|
args.push_back( new ObjectConstCalcer( new IntImp( which ) ) );
|
|
|
|
|
if ( ( tqparents[0]->imp()->inherits( CircleImp::stype() ) ) &&
|
|
|
|
|
( tqparents[1]->imp()->inherits( CircleImp::stype() ) ) )
|
|
|
|
|
if ( ( parents[0]->imp()->inherits( CircleImp::stype() ) ) &&
|
|
|
|
|
( parents[1]->imp()->inherits( CircleImp::stype() ) ) )
|
|
|
|
|
type = CircleCircleIntersectionType::instance();
|
|
|
|
|
else if ( ( tqparents[0]->imp()->inherits( CircleImp::stype() ) &&
|
|
|
|
|
tqparents[1]->imp()->inherits( AbstractLineImp::stype() ) ) ||
|
|
|
|
|
( tqparents[1]->imp()->inherits( CircleImp::stype() ) &&
|
|
|
|
|
tqparents[0]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
else if ( ( parents[0]->imp()->inherits( CircleImp::stype() ) &&
|
|
|
|
|
parents[1]->imp()->inherits( AbstractLineImp::stype() ) ) ||
|
|
|
|
|
( parents[1]->imp()->inherits( CircleImp::stype() ) &&
|
|
|
|
|
parents[0]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
type = ConicLineIntersectionType::instance();
|
|
|
|
|
else if ( ( tqparents[0]->imp()->inherits( ArcImp::stype() ) &&
|
|
|
|
|
tqparents[1]->imp()->inherits( AbstractLineImp::stype() ) ) ||
|
|
|
|
|
( tqparents[1]->imp()->inherits( ArcImp::stype() ) &&
|
|
|
|
|
tqparents[0]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
else if ( ( parents[0]->imp()->inherits( ArcImp::stype() ) &&
|
|
|
|
|
parents[1]->imp()->inherits( AbstractLineImp::stype() ) ) ||
|
|
|
|
|
( parents[1]->imp()->inherits( ArcImp::stype() ) &&
|
|
|
|
|
parents[0]->imp()->inherits( AbstractLineImp::stype() ) ) )
|
|
|
|
|
type = ArcLineIntersectionType::instance();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -377,13 +377,13 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Reflexion" )
|
|
|
|
|
oc = new ObjectTypeCalcer( LineReflectionType::instance(), tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( LineReflectionType::instance(), parents );
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Symmetry" )
|
|
|
|
|
oc = new ObjectTypeCalcer( PointReflectionType::instance(), tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( PointReflectionType::instance(), parents );
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Translation" )
|
|
|
|
|
oc = new ObjectTypeCalcer( TranslatedType::instance(), tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( TranslatedType::instance(), parents );
|
|
|
|
|
else if ( domelem.attribute( "type" ) == "Rotation" )
|
|
|
|
|
oc = new ObjectTypeCalcer( RotationType::instance(), tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( RotationType::instance(), parents );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
notSupported( file, i18n( "This Dr. Geo file contains a \"%1 %2\" object, "
|
|
|
|
@ -423,7 +423,7 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
domelem.attribute( "type" ) ) );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
oc = new ObjectTypeCalcer( type, tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( type, parents );
|
|
|
|
|
}
|
|
|
|
|
else if( domelem.attribute( "type" ) == "3pts" )
|
|
|
|
|
{
|
|
|
|
@ -436,19 +436,19 @@ KigDocument* KigFilterDrgeo::importFigure( TQDomNode f, const TQString& file, co
|
|
|
|
|
domelem.attribute( "type" ) ) );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
oc = new ObjectTypeCalcer( type, tqparents );
|
|
|
|
|
oc = new ObjectTypeCalcer( type, parents );
|
|
|
|
|
}
|
|
|
|
|
else if( domelem.attribute( "type" ) == "segment" )
|
|
|
|
|
{
|
|
|
|
|
if( domelem.tagName() == "circle" )
|
|
|
|
|
{
|
|
|
|
|
type = CircleBPRType::instance();
|