Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
shibakaneki 13 years ago
commit 7bc798f848
  1. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra.jar
  2. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra_cas.jar
  3. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra_export.jar
  4. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra_gui.jar
  5. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra_main.jar
  6. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/bin/geogebra_properties.jar
  7. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/config.xml
  8. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/icon.png
  9. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/images/loading.gif
  10. 0
      resources/library/nonDistributedInteractivities/Geogebra.wgt/index.html
  11. 53
      src/adaptors/UBSvgSubsetAdaptor.cpp
  12. 1
      src/adaptors/UBSvgSubsetAdaptor.h
  13. 12
      src/tools/UBGraphicsTriangle.h

@ -654,7 +654,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->registerTool(protractor); scene->registerTool(protractor);
} }
} }
else if (mXmlReader.name() == "protractor") else if (mXmlReader.name() == "triangle")
{ {
UBGraphicsTriangle *triangle = triangleFromSvg(); UBGraphicsTriangle *triangle = triangleFromSvg();
@ -1060,6 +1060,14 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
protractorToSvg(protractor); protractorToSvg(protractor);
continue; continue;
} }
UBGraphicsTriangle *triangle = qgraphicsitem_cast<UBGraphicsTriangle*> (item);
if (triangle && triangle->isVisible())
{
triangleToSvg(triangle);
continue;
}
} }
if (openStroke) if (openStroke)
@ -2589,6 +2597,39 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg()
return protractor; return protractor;
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::triangleToSvg(UBGraphicsTriangle *item)
{
/**
*
* sample
*
<ub:triangle x="250" y="150" width="122" height="67"...>
</ub:triangle>
*/
mXmlWriter.writeStartElement(UBSettings::uniboardDocumentNamespaceUri, "triangle");
mXmlWriter.writeAttribute("x", QString("%1").arg(item->boundingRect().x()));
mXmlWriter.writeAttribute("y", QString("%1").arg(item->boundingRect().y()));
mXmlWriter.writeAttribute("width", QString("%1").arg(item->boundingRect().width()));
mXmlWriter.writeAttribute("height", QString("%1").arg(item->boundingRect().height()));
mXmlWriter.writeAttribute("transform", toSvgTransform(item->sceneMatrix()));
mXmlWriter.writeAttribute("orientation", UBGraphicsTriangle::orientationToStr(item->getOrientation()));
QString zs;
zs.setNum(item->zValue(), 'f'); // 'f' keeps precision
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value", zs);
UBItem* ubItem = dynamic_cast<UBItem*>(item);
if (ubItem)
{
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(ubItem->uuid()));
}
mXmlWriter.writeEndElement();
}
UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
{ {
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); UBGraphicsTriangle* triangle = new UBGraphicsTriangle();
@ -2598,20 +2639,12 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
graphicsItemFromSvg(triangle); graphicsItemFromSvg(triangle);
QStringRef svgX = mXmlReader.attributes().value("x");
QStringRef svgY = mXmlReader.attributes().value("y");
QStringRef svgWidth = mXmlReader.attributes().value("width");
QStringRef svgHeight = mXmlReader.attributes().value("height");
QStringRef orientationStringRef = mXmlReader.attributes().value("orientation"); QStringRef orientationStringRef = mXmlReader.attributes().value("orientation");
UBGraphicsTriangle::UBGraphicsTriangleOrientation orientation = UBGraphicsTriangle::orientationFromStr(orientationStringRef); UBGraphicsTriangle::UBGraphicsTriangleOrientation orientation = UBGraphicsTriangle::orientationFromStr(orientationStringRef);
triangle->setOrientation(orientation);
if (!svgX.isNull() && !svgY.isNull() && !svgWidth.isNull() && !svgHeight.isNull())
{
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation);
}
triangle->setVisible(true); triangle->setVisible(true);
return triangle; return triangle;
} }

@ -210,6 +210,7 @@ class UBSvgSubsetAdaptor
void rulerToSvg(UBGraphicsRuler *item); void rulerToSvg(UBGraphicsRuler *item);
void compassToSvg(UBGraphicsCompass *item); void compassToSvg(UBGraphicsCompass *item);
void protractorToSvg(UBGraphicsProtractor *item); void protractorToSvg(UBGraphicsProtractor *item);
void triangleToSvg(UBGraphicsTriangle *item);
void writeSvgElement(); void writeSvgElement();
private: private:

@ -66,12 +66,24 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
if (str == "TopRight") return TopRight; if (str == "TopRight") return TopRight;
return sDefaultOrientation; return sDefaultOrientation;
} }
static QString orientationToStr(UBGraphicsTriangleOrientation orientation)
{
QString result;
if (orientation == 0) result = "BottomLeft";
else if (orientation == 1) result = "BottomRight";
else if (orientation == 2) result = "TopLeft";
else if (orientation == 3) result = "TopRight";
return result;
}
void setRect(const QRectF &rect, UBGraphicsTriangleOrientation orientation) void setRect(const QRectF &rect, UBGraphicsTriangleOrientation orientation)
{ {
setRect(rect.x(), rect.y(), rect.width(), rect.height(), orientation); setRect(rect.x(), rect.y(), rect.width(), rect.height(), orientation);
} }
void setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsTriangleOrientation orientation); void setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsTriangleOrientation orientation);
void setOrientation(UBGraphicsTriangleOrientation orientation); void setOrientation(UBGraphicsTriangleOrientation orientation);
UBGraphicsTriangleOrientation getOrientation() const {return mOrientation;}
QRectF rect() const {return boundingRect();} QRectF rect() const {return boundingRect();}
UBGraphicsScene* scene() const; UBGraphicsScene* scene() const;

Loading…
Cancel
Save