void RGraphicsSceneQt::exportRay(const RRay& ray) { bool created = beginPath(); Q_ASSERT(currentPainterPath.isValid()); // find largest view box over all attached views: RBox box; QList<RGraphicsView*>::iterator it; for (it=views.begin(); it!=views.end(); it++) { RBox b = (*it)->getBox(); box.growToIncludeBox(b); } // trim line to view box: RLine clippedLine = ray.getClippedLine(box); double offs = clippedLine.getStartPoint().getDistanceTo(ray.getBasePoint()); if (RMath::isSameDirection(ray.getBasePoint().getAngleTo(clippedLine.getStartPoint()), ray.getDirection1())) { offs *= -1; } exportLine(clippedLine, offs); currentPainterPath.setAlwaysRegen(true); if (created) { endPath(); } }
QScriptValue REcmaSharedPointerRay::reverse (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::reverse", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::reverse"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("reverse", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 0 ){ // prepare arguments: // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->reverse(); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.reverse().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::reverse", context, engine); return result; }
void RRayEntity::setShape(const RRay& r) { data.setBasePoint(r.getBasePoint()); data.setSecondPoint(r.getSecondPoint()); }
QScriptValue REcmaSharedPointerRay::getVectorTo (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::getVectorTo", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::getVectorTo"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("getVectorTo", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isBool() ) /* type: bool */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0 , a1); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 3 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isBool() ) /* type: bool */ && ( context->argument(2).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0 , a1 , a2); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.getVectorTo().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::getVectorTo", context, engine); return result; }
QScriptValue REcmaSharedPointerRay::getPointsWithDistanceToEnd (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::getPointsWithDistanceToEnd", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::getPointsWithDistanceToEnd"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("getPointsWithDistanceToEnd", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isNumber() ) /* type: double */ && ( context->argument(1).isNumber() ) /* type: RS::From */ ){ // prepare arguments: // argument isStandardType double a0 = (double) context->argument( 0 ). toNumber(); // argument isStandardType RS::From a1 = (RS::From) (int) context->argument( 1 ). toNumber(); // end of arguments // call C++ function: // return type 'QList < RVector >' QList < RVector > cppResult = self->getPointsWithDistanceToEnd(a0 , a1); // return type: QList < RVector > // List of ...: result = REcmaHelper::listToScriptValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.getPointsWithDistanceToEnd().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::getPointsWithDistanceToEnd", context, engine); return result; }
QScriptValue REcmaSharedPointerRay::stretch (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::stretch", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::stretch"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("stretch", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RPolyline */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RPolyline* ap0 = qscriptvalue_cast< RPolyline* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RPolyline.", context); } RPolyline a0 = *ap0; // argument isCopyable and has default constructor and isSimpleClass RVector* ap1 = qscriptvalue_cast< RVector* >( context->argument( 1 ) ); if (ap1 == NULL) { return REcmaHelper::throwError("RRay: Argument 1 is not of type RVector.", context); } RVector a1 = *ap1; // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->stretch(a0 , a1); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.stretch().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::stretch", context, engine); return result; }