moduleData.Geometry.Ipe.IpeGeometryTypeswhereimportData.Geometry.PointimportData.Geometry.LineimportData.Geometry.PolygonimportData.Geometry.GeometryimportData.Geometry.Ipe.IpeTypesimportqualifiedData.MapasM---------------------------------------------------------------------------------------- | An ipe point.dataIpePoint'a=IpePoint(Point2'a)AMapderiving(Eq,Ord,Read,Show)instanceIsPoint2FunctorIpePoint'wherep2fmapf(IpePointpa)=IpePoint(fp)ainstanceHasPointsIpePoint'wherepoints(IpePointp_)=[p]instanceHasAttributes(IpePoint'a)whereattrs(IpePoint_a)=aupdateWithf(IpePointpa)=IpePointp(fa)-- | create a default ipe point from a given pointfromPoint::Point2'a->IpePoint'afromPoint=flipIpePoint$M.fromList[("name","mark/disk(sx)")]---------------------------------------------------------------------------------------- | A polylinedataIpePolyline'a=IpePolyline[LineSegment2'a]AMapderiving(Show,Eq)instanceIsPoint2FunctorIpePolyline'wherep2fmapf(IpePolylinelinesa)=IpePolyline(map(p2fmapf)lines)ainstanceHasPointsIpePolyline'wherepoints=points.toPolyLineinstanceHasAttributes(IpePolyline'a)whereattrs(IpePolyline_a)=aupdateWithf(IpePolylinepa)=IpePolylinep(fa)toPolyLine::IpePolyline'a->Polyline2'atoPolyLine(IpePolylinels_)=Polyline2lsfromPolyline::Polyline2'a->IpePolyline'afromPolyline(Polyline2ls)=IpePolylinelsM.empty---------------------------------------------------------------------------------------- | PolygonsdataIpeSimplePolygon'a=IpeSimplePolygon[Point2'a]AMapderiving(Show,Eq)instanceIsPoint2FunctorIpeSimplePolygon'wherep2fmapf(IpeSimplePolygonptsa)=IpeSimplePolygon(mapfpts)ainstanceHasPointsIpeSimplePolygon'wherepoints(IpeSimplePolygonpts_)=ptsinstanceHasAttributes(IpeSimplePolygon'a)whereattrs(IpeSimplePolygon_a)=aupdateWithf(IpeSimplePolygonpa)=IpeSimplePolygonp(fa)instanceIsPolygonIpeSimplePolygon'whereisSimple=constTruecontainsHoles=constFalse-- note a ipeMultiPolygon consists of ``SimplePolygon''s, not ``IpeSimplePolygon''sdataIpeMultiPolygon'a=IpeMultiPolygon[SimplePolygon'a]AMapderiving(Show,Eq)instanceIsPoint2FunctorIpeMultiPolygon'wherep2fmapf(IpeMultiPolygonpolysa)=IpeMultiPolygon(map(p2fmapf)polys)ainstanceHasPointsIpeMultiPolygon'wherepoints(IpeMultiPolygonpolys_)=concatMappointspolysinstanceHasAttributes(IpeMultiPolygon'a)whereattrs(IpeMultiPolygon_a)=aupdateWithf(IpeMultiPolygonpa)=IpeMultiPolygonp(fa)-- TODO whether or not there are holes or the thing is simple actually depends-- on the thing, so we need code here rather than a simple const FalseinstanceIsPolygonIpeMultiPolygon'whereisSimple=constFalsecontainsHoles=constFalse