Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
adef5d6f
Commit
adef5d6f
authored
Nov 27, 2012
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polygon is created from points via convex_hull
parent
72f9358f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
common/lib/capa/capa/responsetypes.py
+10
-6
No files found.
common/lib/capa/capa/responsetypes.py
View file @
adef5d6f
...
@@ -23,7 +23,7 @@ import abc
...
@@ -23,7 +23,7 @@ import abc
import
os
import
os
import
subprocess
import
subprocess
import
xml.sax.saxutils
as
saxutils
import
xml.sax.saxutils
as
saxutils
from
shapely.geometry
import
Po
lygon
,
Point
from
shapely.geometry
import
Po
int
,
Multi
Point
# specific library imports
# specific library imports
from
calc
import
evaluator
,
UndefinedVariable
from
calc
import
evaluator
,
UndefinedVariable
...
@@ -1796,16 +1796,20 @@ class ImageResponse(LoncapaResponse):
...
@@ -1796,16 +1796,20 @@ class ImageResponse(LoncapaResponse):
break
break
# import ipdb; ipdb.set_trace()
# import ipdb; ipdb.set_trace()
if
correct_map
[
aid
][
'correctness'
]
!=
'correct'
and
regions
[
aid
]:
if
correct_map
[
aid
][
'correctness'
]
!=
'correct'
and
regions
[
aid
]:
import
ipdb
;
ipdb
.
set_trace
()
#
import ipdb; ipdb.set_trace()
parsed_region
=
json
.
loads
(
regions
[
aid
])
parsed_region
=
json
.
loads
(
regions
[
aid
])
if
parsed_region
:
if
parsed_region
:
if
type
(
parsed_region
[
0
][
0
])
!=
list
:
if
type
(
parsed_region
[
0
][
0
])
!=
list
:
# we have [[1,2],[3,4],[5,6] - single region
# we have [[1,2],[3,4],[5,6]
]
- single region
# instead of [[[1,2],[3,4],[5,6], [[1,2],[3,4],[5,6]]
# instead of [[[1,2],[3,4],[5,6], [[1,2],[3,4],[5,6]]
]
# or [[[1,2],[3,4],[5,6]] - multiple regions syntax
# or [[[1,2],[3,4],[5,6]]
]
- multiple regions syntax
parsed_region
=
[
parsed_region
]
parsed_region
=
[
parsed_region
]
# if aid =='1_3_6':
# import ipdb; ipdb.set_trace()
for
region
in
parsed_region
:
for
region
in
parsed_region
:
if
Polygon
(
region
)
.
contains
(
Point
(
gx
,
gy
)):
polygon
=
MultiPoint
(
region
)
.
convex_hull
if
(
polygon
.
type
==
'Polygon'
and
polygon
.
contains
(
Point
(
gx
,
gy
))):
correct_map
.
set
(
aid
,
'correct'
)
correct_map
.
set
(
aid
,
'correct'
)
break
break
return
correct_map
return
correct_map
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment