// AnimatedPath(Point const & start_point, Point const & end_point, int const & beginn, int const & duration, // Fill const & fill = Fill(), Stroke const & stroke = Stroke()) // : Shape(fill, stroke), start_point(start_point), end_point(end_point), beginn(beginn), duration(duration) { } // AnimatedPath(Stroke const & stroke = Stroke()) : Shape(Color::Transparent, stroke) { } // Polygon & operator<<(Point const & point) // { // points.push_back(point); // return *this; // } std::string toString(Layout const & layout) const { std::stringstream ss; ss << elemStart("path"); ss << "d=\""; std::stringstream startPoint; std::stringstream beforePoint; std::stringstream afterPoint; startPoint << "M " << translateX(start_point.x, layout) << "," << translateY(start_point.y, layout) << " "; ss << startPoint.str(); beforePoint << "L " << translateX(start_point.x, layout) << "," << translateY(start_point.y, layout) << "\""; afterPoint << "L " << translateX(end_point.x, layout) << "," << translateY(end_point.y, layout) << "\""; ss << beforePoint.str() << " "<< fill.toString(layout) << stroke.toString(layout)<< ">"; ss << elemStart("animate"); ss << " attributeType=\"XML\" attributeName=\"d\" fill=\"freeze\" "; ss << "from=\"" << startPoint.str() << " " << beforePoint.str() << " "; ss << "to=\"" << startPoint.str() << " " << afterPoint.str() << ""; ss << " begin=\"" << beginn << "\" "; ss << "dur=\"" << duration << "\""; ss << emptyElemEnd(); ss << elemEnd("path"); // for (unsigned i = 0; i < points.size(); ++i) // ss << translateX(points[i].x, layout) << "," << translateY(points[i].y, layout) << " "; // ss << fill.toString(layout) << stroke.toString(layout) << emptyElemEnd(); return ss.str(); }
std::string toString(Layout const & layout) const { std::stringstream ss; ss << elemStart("text") << attribute("x", translateX(origin.x, layout)) << attribute("y", translateY(origin.y, layout)) << fill.toString(layout) << stroke.toString(layout) << font.toString(layout) << ">" << content << elemEnd("text"); return ss.str(); }
CubeArea* CubeArea::expandBase(AggregationMaps *aggregationMaps) const { const vector<Dimension*> &dimensions = *cube->getDimensions(); CubeArea* result = new CubeArea(env, cube, dimensions.size()); aggregationMaps->resize(dimensions.size()); if (dimCount() != dimensions.size()) { throw ErrorException( ErrorException::ERROR_INTERNAL, "CubeArea::expandBase area and dimension size differ."); } auto didit = dimensions.begin(); for (size_t dim = 0; dim < dimCount(); dim++, ++didit) { Dimension* dimension = *didit; Set* s = new Set(); for (ConstElemIter eit = elemBegin(dim); eit != elemEnd(dim); ++eit) { IdentifierType eId = *eit; Element* element = dimension->lookupElement(eId); if (!element) { LOG(ERROR) << "CubeArea::expandBase element id: " << *eit << " not found in dimension: " << dimension->getName(); continue; // possible corrupted journal } /* DLOG(WARNING) << "CubeArea::expandBase element id: " << eId << " added in dimension: " << dimension->getName() ; */ try { const WeightedSet* baseE = dimension->getBaseElements(element); for (auto baseIt = baseE->begin(); baseIt != baseE->end(); ++baseIt) { // it seems there is a bug in Set::insert which adds the same id multiple times. // therefore check if the element already exists if (s->find(baseIt.first()) == s->end()) { s->insert(baseIt.first()); } } /* DLOG(WARNING) << "CubeArea::expandBase adding " << baseE->size() << " source elements to aggregation map." ; */ aggregationMaps->at(dim).buildBaseToParentMap(eId, baseE); } catch (const ErrorException& e) { // LOG(ERROR) << "CubeArea::expandBase exception: " << e.getMessage(); } } result->insert(dim, s); aggregationMaps->at(dim).compactSourceToTarget(); } return result; }
std::string toString() const { std::stringstream ss; ss << "<?xml " << attribute("version", "1.0") << attribute("standalone", "no") << "?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" " << "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg " << attribute("width", layout.dimensions.width, "px") << attribute("height", layout.dimensions.height, "px") << attribute("xmlns", "http://www.w3.org/2000/svg") << attribute("version", "1.1") << ">\n" << body_nodes_str << elemEnd("svg"); return ss.str(); }