Hey,
I am looking to make a custom marker of multiple >, that could be >> or >>>. I wrote the following code, and it seems to work, but the markers come out as circles. What am I doing wrong?
HPS::GlyphPoint ConvertToGlyphPt( std::vector<double> const& point )
{
HPS::GlyphPoint glyphPoint;
auto normalizedPt = NormalizePoint( point );
glyphPoint.x = normalizedPt.x;
glyphPoint.y = normalizedPt.y;
return glyphPoint;
}
void InsertArrows( COLORREF color,
int lineStyle,
std::vector<Arrowhead> const& arrowheads )
{
if( arrowheads.empty() )
{
return;
}
HPS::SegmentKey childSegmentKey = plot.Subsegment( "Arrowheads" ).Subsegment();
CStringA glyphName {};
glyphName.Format( "arrowhead_%zu", arrowheads.size() );
if( !m_portfolio.ShowGlyphDefinition( glyphName.GetString() ) )
{
HPS::GlyphKit glyphBuilder {};
glyphBuilder.SetRadius( 0 );
glyphBuilder.SetOffset( { 0, 0 } );
HPS::LineGlyphElement arrows {};
HPS::PointArray pointArray;
HPS::GlyphPointArray points {};
for( auto i { 0 }; i < arrowheads.size(); ++i )
{
points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
points.push_back( ConvertToGlyphPt( arrowheads[i].legOne ) );
points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
points.push_back( ConvertToGlyphPt( arrowheads[i].legTwo ) );
points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
if( i != arrowheads.size() - 1 )
{
points.push_back( ConvertToGlyphPt( arrowheads[i + 1].center ) );
}
}
arrows.SetPoints( points );
glyphBuilder.SetElement( arrows );
m_portfolio.DefineGlyph( glyphName.GetString(), glyphBuilder );
}
childSegmentKey.GetMarkerAttributeControl().SetSymbol( glyphName.GetString() );
childSegmentKey.GetMaterialMappingControl().SetMarkerColor( COLORREF2RGB( color ) );
childSegmentKey.GetMarkerAttributeControl().SetSize( 20, HPS::Marker::SizeUnits::Pixels );
HPS::Vector translationVector {};
msl::XYZPoint<double> normalizedCenter {};
NormalizeToCurrentWindow( arrowheads[0].center, normalizedCenter, translationVector );
HPS::MatrixKit childSegmentMatrix;
childSegmentMatrix.Translate( translationVector );
childSegmentKey.SetModellingMatrix( childSegmentMatrix );
childSegmentKey.InsertMarker( HPS::Point( normalizedCenter.x,
normalizedCenter.y,
normalizedCenter.z ) );
}