QgsStringMap QgsArrowSymbolLayer::properties() const { QgsStringMap map; map["arrow_width"] = QString::number( arrowWidth() ); map["arrow_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( arrowWidthUnit() ); map["arrow_width_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( arrowWidthUnitScale() ); map["arrow_start_width"] = QString::number( arrowStartWidth() ); map["arrow_start_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( arrowStartWidthUnit() ); map["arrow_start_width_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( arrowStartWidthUnitScale() ); map["is_curved"] = QString::number( isCurved() ? 1 : 0 ); map["is_repeated"] = QString::number( isRepeated() ? 1 : 0 ); map["head_width"] = QString::number( headWidth() ); map["head_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( headWidthUnit() ); map["head_width_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( headWidthUnitScale() ); map["head_height"] = QString::number( headHeight() ); map["head_height_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( headHeightUnit() ); map["head_height_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( headHeightUnitScale() ); map["head_type"] = QString::number( headType() ); map["arrow_type"] = QString::number( arrowType() ); map["offset"] = QString::number( offset() ); map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( offsetUnit() ); map["offset_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( offsetMapUnitScale() ); saveDataDefinedProperties( map ); return map; }
int main() { //char a[100] = "abcabccccabcabcccc"; char a[100] = "abcabccccabcabccc"; //char a[100] = ""; //char b[100] = "abcabcccc"; char b[100] = ""; int p = isRepeated(a,b); printf("%d",p); return 0; }
bool System::texture_isRepeated(unsigned int id) { auto texture = mTextureHandler.get(id); if(nullptr == texture) { return false; } return texture->isRepeated(); }
void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ) { Q_UNUSED( points ); if ( !context.renderContext().painter() ) { return; } context.renderContext().expressionContext().appendScope( mExpressionScope.data() ); mExpressionScope->setVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_COUNT, points.size() + 1 ); mExpressionScope->setVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, 1 ); if ( isCurved() ) { _resolveDataDefined( context ); if ( ! isRepeated() ) { if ( points.size() >= 3 ) { // origin point QPointF po( points.at( 0 ) ); // middle point QPointF pm( points.at( points.size() / 2 ) ); // destination point QPointF pd( points.back() ); QPolygonF poly = curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } // straight arrow else if ( points.size() == 2 ) { // origin point QPointF po( points.at( 0 ) ); // destination point QPointF pd( points.at( 1 ) ); QPolygonF poly = straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } } else { for ( int pIdx = 0; pIdx < points.size() - 1; pIdx += 2 ) { mExpressionScope->setVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, pIdx + 1 ); _resolveDataDefined( context ); if ( points.size() - pIdx >= 3 ) { // origin point QPointF po( points.at( pIdx ) ); // middle point QPointF pm( points.at( pIdx + 1 ) ); // destination point QPointF pd( points.at( pIdx + 2 ) ); QPolygonF poly = curvedArrow( po, pm, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } // straight arrow else if ( points.size() - pIdx == 2 ) { // origin point QPointF po( points.at( pIdx ) ); // destination point QPointF pd( points.at( pIdx + 1 ) ); QPolygonF poly = straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } } } } else { if ( !isRepeated() ) { _resolveDataDefined( context ); // origin point QPointF po( points.at( 0 ) ); // destination point QPointF pd( points.back() ); QPolygonF poly = straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } else { // only straight arrows for ( int pIdx = 0; pIdx < points.size() - 1; pIdx++ ) { mExpressionScope->setVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, pIdx + 1 ); _resolveDataDefined( context ); // origin point QPointF po( points.at( pIdx ) ); // destination point QPointF pd( points.at( pIdx + 1 ) ); QPolygonF poly = straightArrow( po, pd, mScaledArrowStartWidth, mScaledArrowWidth, mScaledHeadWidth, mScaledHeadHeight, mComputedHeadType, mComputedArrowType, mScaledOffset ); mSymbol->renderPolygon( poly, /* rings */ nullptr, context.feature(), context.renderContext() ); } } } context.renderContext().expressionContext().popScope(); }