@startuml
' Simplified PlantUML class diagram for spatial indexing subsystem

' Abstract base class with virtual operations
abstract class SpatialIndexBase<T> {
  -bool m_isSpatialIndexVoid
  -T* m_spatialIndexPtr
  -int m_minSpaceUnit
  -int m_imgRows
  -int m_imgCols
  +SpatialIndexBase(int rows, int cols, int minUnit)
  +abstract ~SpatialIndexBase()
  +virtual void initSpatialIndex<T>()
  +abstract void insert(T data)
  +abstract void delete(T data)
  +abstract void alter(T data, T newData)
  +virtual void clear()
  +abstract void ApplyForMemory<T>()
  +abstract void Spreading<T>()
}

' Derived class for contours
class SpatialIndexOfContours {
  -ContoursInfoForSpatialIndex* m_contoursPtr
  +SpatialIndexOfContours(int rows, int cols, int minUnit)
  +override void insert(Contour data)
  +override void delete(Contour data)
  +override void alter(Contour data, Contour newData)
}

' Derived class for colors
class SpatialIndexOfColors {
  -ColorStatistics* m_colorStats
  +SpatialIndexOfColors(int rows, int cols, int minUnit)
  +override void insert(ColorData data)
  +override void delete(ColorData data)
  +override void alter(ColorData data, ColorData newData)
}

' Derived class for color clusters
class SpatialIndexOfColorCluster {
  -HSVStatistics* m_hsvStats
  +SpatialIndexOfColorCluster(HSVImg, MaskImg, StartIndexs, isGray, minSpaceUnit)
  +void FillHSVStatisticsData()
}

' Derived class for lines
class SpatialIndexOfLines {
  -LineInfo* m_lineInfoPtr
  +SpatialIndexOfLines(int rows, int cols, int minUnit)
  +override void insert(Line data)
  +override void delete(Line data)
  +override void alter(Line data, Line newData)
}

' Derived class for mark matrices
class SpatialIndexOfMarkMatrix {
  -MarkMatrix* m_markMatrixPtr
  +SpatialIndexOfMarkMatrix(int rows, int cols, int minUnit)
  +override void insert(Contour data)
  +override void delete(Contour data)
  +override void alter(Contour data, Contour newData)
}

' Derived class for polygons
class SpatialIndexOfPolygons {
  -PolygonInfo* m_polygonInfoPtr
  +SpatialIndexOfPolygons(int rows, int cols, int minUnit)
  +override void insert(Polygon data)
  +override void delete(Polygon data)
  +override void alter(Polygon data, Polygon newData)
}

' Utility classes
class ScoringStrategy {
  +float calculateBlockScore(type: string, data: T)
  +float calculateGradientScore(data: T)
}

' Relationships
SpatialIndexBase <|.. SpatialIndexOfContours
SpatialIndexBase <|.. SpatialIndexOfColors
SpatialIndexOfColors <|.. SpatialIndexOfColorCluster
SpatialIndexBase <|.. SpatialIndexOfLines
SpatialIndexBase <|.. SpatialIndexOfMarkMatrix
SpatialIndexBase <|.. SpatialIndexOfPolygons
SpatialIndexOfColors --> ScoringStrategy : uses

' Notes
note right of SpatialIndexBase
  Virtual base class for spatial indexing.
  initSpatialIndex, clear are virtual.
  insert, delete, alter, ApplyForMemory, Spreading, destructor are pure virtual.
end note

note right of ScoringStrategy
  Manages scoring logic for blocks and features.
end note

@enduml
-----------------------------------------------------------------------------------------
make the following modifications to the above plantuml diagram, give explicit pure virtual declaration for the appropriate base class methods:


VIRTUAL VS PURE VIRTUAL:
-> initSpatialIndex will be VIRTUAL because it also INITs pixel level
-> all clears will be PURE VIRTUAL since there is no clear in the base class
-> I think we should NOT INCLUDE GET functions as they are different for each obj
-> INSERT will def be a PURE VIRTUAL function
-> CLEAR can be VIRTUAL if we have a default implementation which just clears everything from an index all kinds of data
-> DELETE will def be PURE VIRTUAL as each object deletes in a specific way
-> ALTER/EDIT will also be PURE VIRTUAL