X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_image.cpp;h=a92297f2c3295d57b01947d964b72e0f3e20bb32;hb=27d4a138d23453e93a833e9347444b828a971cb4;hp=bf0e1c496ca1f2fe13e912ecb88f3bfe0141db9c;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/base/rs_image.cpp b/src/base/rs_image.cpp index bf0e1c4..a92297f 100644 --- a/src/base/rs_image.cpp +++ b/src/base/rs_image.cpp @@ -16,7 +16,8 @@ #include "rs_constructionline.h" #include "rs_debug.h" -#include "rs_graphicview.h" +#include "graphicview.h" +#include "rs_line.h" #include "paintintf.h" /** @@ -35,8 +36,8 @@ RS_Image::RS_Image(RS_EntityContainer * parent, const RS_ImageData & d): RS_Image::~RS_Image() { /*if (img!=NULL) { - delete[] img; - }*/ + delete[] img; + }*/ } RS_Entity * RS_Image::clone() @@ -48,6 +49,12 @@ RS_Entity * RS_Image::clone() return i; } +/** @return RS2::EntityImage */ +/*virtual*/ RS2::EntityType RS_Image::rtti() const +{ + return RS2::EntityImage; +} + void RS_Image::update() { RS_DEBUG->print("RS_Image::update"); @@ -62,38 +69,154 @@ void RS_Image::update() RS_DEBUG->print("RS_Image::update: OK"); /* - // number of small images: - nx = image.width()/100; - ny = image.height()/100; - - // create small images: - img = new QImage*[nx]; - RS_Pixmap pm; - int w,h; - for (int x = 0; xgetHeight(); Vector scale = Vector(view->toGuiDX(data.uVector.magnitude()), - view->toGuiDY(data.vVector.magnitude())); + view->toGuiDY(data.vVector.magnitude())); double angle = data.uVector.angle(); int startX, stopX, startY, stopY; if (data.uVector.x > 1.0e-6 && data.vVector.y > 1.0e-6) { - startX = (int)((view->toGraphX(ox)-data.insertionPoint.x) / data.uVector.x) - 1; + startX = (int)((view->toGraphX(ox) - data.insertionPoint.x) / data.uVector.x) - 1; if (startX < 0) - { startX = 0; - } - stopX = (int)((view->toGraphX(width)-data.insertionPoint.x) / data.uVector.x) + 1; + stopX = (int)((view->toGraphX(width) - data.insertionPoint.x) / data.uVector.x) + 1; if (stopX > (int)data.size.x) - { stopX = (int)data.size.x; - } - startY = -(int)((view->toGraphY(oy) - (data.insertionPoint.y+getImageHeight())) / - data.vVector.y) - 1; + startY = -(int)((view->toGraphY(oy) - (data.insertionPoint.y + getImageHeight())) + / data.vVector.y) - 1; - if (startY<0) - { + if (startY < 0) startY = 0; - } - stopY = -(int)((view->toGraphY(height) - (data.insertionPoint.y+getImageHeight())) / - data.vVector.y) + 1; + stopY = -(int)((view->toGraphY(height) - (data.insertionPoint.y + getImageHeight())) + / data.vVector.y) + 1; - if (stopY>(int)data.size.y) - { + if (stopY > (int)data.size.y) stopY = (int)data.size.y; - } } else { @@ -310,7 +413,7 @@ void RS_Image::draw(PaintInterface * painter, RS_GraphicView * view, double /*pa } painter->drawImg(img, view->toGui(data.insertionPoint), angle, scale, - startX, startY, stopX-startX, stopY-startY); + startX, startY, stopX - startX, stopY - startY); if (isSelected()) { @@ -331,4 +434,3 @@ std::ostream & operator<<(std::ostream & os, const RS_Image & i) os << " Image: " << i.getData() << "\n"; return os; } -