Implements polygon and line.