void XmppStream::onFeatureFinished(bool ARestart) { if (!ARestart) processFeatures(); else startStream(); }
void DMRecon::start() { progress.start_time = std::time(0); analyzeFeatures(); globalViewSelection(); processFeatures(); processQueue(); if (progress.cancelled) { progress.status = RECON_CANCELLED; return; } progress.status = RECON_SAVING; SingleViewPtr refV(views[settings.refViewNr]); if (settings.writePlyFile) { refV->saveReconAsPly(settings.plyPath, settings.scale); } refV->writeReconImages(settings.scale); progress.status = RECON_IDLE; // Output percentage of filled pixels { int nrPix = this->width * this->height; float percent = (float) progress.filled / (float) nrPix; std::cout << "Filled " << progress.filled << " pixels, i.e. " << util::string::get_fixed(percent * 100.f, 1) << " %." << std::endl; log << "Filled " << progress.filled << " pixels, i.e. " << util::string::get_fixed(percent * 100.f, 1) << " %." << std::endl; } // Output required time to process the image { size_t mvs_time = std::time(0) - progress.start_time; std::cout << "MVS took " << mvs_time << " seconds." << std::endl; log << "MVS took " << mvs_time << " seconds." << std::endl; } }
bool XmppStream::xmppStanzaIn(IXmppStream *AXmppStream, Stanza &AStanza, int AOrder) { if (AXmppStream == this && AOrder == XSHO_XMPP_STREAM) { if (FStreamState==SS_INITIALIZE && AStanza.element().nodeName()=="stream:stream") { LogDetail(QString("[XmppStream][%1] XMPP stream initialized").arg(FStreamJid.bare())); FStreamId = AStanza.id(); FStreamState = SS_FEATURES; if (VersionParser(AStanza.element().attribute("version","0.0")) < VersionParser(1,0)) { Stanza stanza("stream:features"); stanza.addElement("register",NS_FEATURE_REGISTER); stanza.addElement("auth",NS_FEATURE_IQAUTH); xmppStanzaIn(AXmppStream, stanza, AOrder); } return true; } else if (FStreamState==SS_FEATURES && AStanza.element().nodeName()=="stream:features") { LogDetail(QString("[XmppStream][%1] Processing XMPP stream features").arg(FStreamJid.bare())); FServerFeatures = AStanza.element().cloneNode(true).toElement(); FAvailFeatures = FXmppStreams->xmppFeaturesOrdered(); processFeatures(); return true; } else if (AStanza.element().nodeName() == "stream:error") { ErrorHandler err(AStanza.element(),NS_XMPP_STREAMS); LogError(QString("[XmppStream][%1] XMPP stream error received: %2").arg(FStreamJid.bare(),err.message())); abort(err.message()); return true; } } return false; }
void SymbolBucket::addFeatures(const GeometryTileLayer& layer, const FilterExpression& filter, uintptr_t tileUID, SpriteAtlas& spriteAtlas, Sprite& sprite, GlyphAtlas& glyphAtlas, GlyphStore& glyphStore) { const std::vector<SymbolFeature> features = processFeatures(layer, filter, glyphStore); // Stop if we still need glyphs because the // bucket will be discarded. if (needsGlyphs()) { return; } float horizontalAlign = 0.5; float verticalAlign = 0.5; switch (layout.text.anchor) { case TextAnchorType::Top: case TextAnchorType::Bottom: case TextAnchorType::Center: break; case TextAnchorType::Right: case TextAnchorType::TopRight: case TextAnchorType::BottomRight: horizontalAlign = 1; break; case TextAnchorType::Left: case TextAnchorType::TopLeft: case TextAnchorType::BottomLeft: horizontalAlign = 0; break; } switch (layout.text.anchor) { case TextAnchorType::Left: case TextAnchorType::Right: case TextAnchorType::Center: break; case TextAnchorType::Bottom: case TextAnchorType::BottomLeft: case TextAnchorType::BottomRight: verticalAlign = 1; break; case TextAnchorType::Top: case TextAnchorType::TopLeft: case TextAnchorType::TopRight: verticalAlign = 0; break; } float justify = 0.5; if (layout.text.justify == TextJustifyType::Right) justify = 1; else if (layout.text.justify == TextJustifyType::Left) justify = 0; auto* fontStack = glyphStore.getFontStack(layout.text.font); for (const auto& feature : features) { if (!feature.geometry.size()) continue; Shaping shaping; Rect<uint16_t> image; GlyphPositions face; // if feature has text, shape the text if (feature.label.length()) { shaping = fontStack->getShaping( /* string */ feature.label, /* maxWidth: ems */ layout.placement != PlacementType::Line ? layout.text.max_width * 24 : 0, /* lineHeight: ems */ layout.text.line_height * 24, /* horizontalAlign */ horizontalAlign, /* verticalAlign */ verticalAlign, /* justify */ justify, /* spacing: ems */ layout.text.letter_spacing * 24, /* translate */ vec2<float>(layout.text.offset[0], layout.text.offset[1])); // Add the glyphs we need for this label to the glyph atlas. if (shaping.size()) { glyphAtlas.addGlyphs(tileUID, feature.label, layout.text.font, *fontStack, face); } } // if feature has icon, get sprite atlas position if (feature.sprite.length()) { image = spriteAtlas.getImage(feature.sprite, false); if (sprite.getSpritePosition(feature.sprite).sdf) { sdfIcons = true; } } // if either shaping or icon position is present, add the feature if (shaping.size() || image.hasArea()) { for (const auto& line : feature.geometry) { if (line.size()) { addFeature(line, shaping, face, image); } } } } }