AI2 Component
(Version nb184)
MapFeatureBaseWithFill.java
Go to the documentation of this file.
1
// -*- mode: java; c-basic-offset: 2; -*-
2
// Copyright 2016-2017 MIT, All rights reserved
3
// Released under the Apache License, Version 2.0
4
// http://www.apache.org/licenses/LICENSE-2.0
5
6
package
com.google.appinventor.components.runtime;
7
8
import
android.graphics.Color;
9
import
com
.
google
.
appinventor
.
components
.
annotations
.
DesignerProperty
;
10
import
com
.
google
.
appinventor
.
components
.
annotations
.
IsColor
;
11
import
com
.
google
.
appinventor
.
components
.
annotations
.
PropertyCategory
;
12
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleObject
;
13
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleProperty
;
14
import
com
.
google
.
appinventor
.
components
.
common
.
PropertyTypeConstants
;
15
import
com
.
google
.
appinventor
.
components
.
runtime
.
util
.
MapFactory
;
16
import
com
.
google
.
appinventor
.
components
.
runtime
.
util
.
MapFactory
.
HasFill
;
17
import
com
.
google
.
appinventor
.
components
.
runtime
.
util
.
MapFactory
.
MapFeatureVisitor
;
18
19
@SimpleObject
20
public
abstract
class
MapFeatureBaseWithFill
extends
MapFeatureBase
implements
HasFill
{
21
private
int
fillColor =
COLOR_RED
;
22
private
float
fillOpacity = 1;
23
24
public
MapFeatureBaseWithFill
(
MapFactory
.
MapFeatureContainer
container
,
25
MapFeatureVisitor<Double>
distanceComputation) {
26
super(
container
, distanceComputation);
27
FillColor
(Color.RED);
28
FillOpacity
(1);
29
}
30
31
@
DesignerProperty
(editorType =
PropertyTypeConstants
.
PROPERTY_TYPE_COLOR
,
32
defaultValue =
Component
.
DEFAULT_VALUE_COLOR_RED
)
33
@
SimpleProperty
34
@Override
35
public
void
FillColor
(
int
argb) {
36
fillColor = argb;
37
map
.
getController
().
updateFeatureFill
(
this
);
38
}
39
43
@
SimpleProperty
(category =
PropertyCategory
.
APPEARANCE
,
44
description =
"The paint color used to fill in the %type%."
)
45
@
IsColor
46
@Override
47
public
int
FillColor
() {
48
return
fillColor;
49
}
50
51
@
DesignerProperty
(editorType =
PropertyTypeConstants
.
PROPERTY_TYPE_FLOAT
,
52
defaultValue =
"1.0"
)
53
@
SimpleProperty
54
@Override
55
public
void
FillOpacity
(
float
opacity) {
56
fillOpacity = opacity;
57
fillColor = (fillColor & 0x00FFFFFF) | (Math.round(0xFF * opacity) << 24);
58
map
.
getController
().
updateFeatureFill
(
this
);
59
}
60
65
@
SimpleProperty
(category =
PropertyCategory
.
APPEARANCE
,
66
description =
"The opacity of the interior of the map feature."
)
67
@Override
68
public
float
FillOpacity
() {
69
return
fillOpacity;
70
}
71
}
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_FLOAT
static final String PROPERTY_TYPE_FLOAT
Definition:
PropertyTypeConstants.java:76
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition:
AccountChooser.java:7
com.google.appinventor.components.runtime.util.MapFactory
Definition:
MapFactory.java:30
com.google.appinventor.components.runtime.util.MapFactory.HasFill
Definition:
MapFactory.java:888
com.google.appinventor.components.annotations.DesignerProperty
Definition:
DesignerProperty.java:25
com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureFill
void updateFeatureFill(HasFill feature)
com.google.appinventor.components.runtime.MapFeatureBaseWithFill.MapFeatureBaseWithFill
MapFeatureBaseWithFill(MapFactory.MapFeatureContainer container, MapFeatureVisitor< Double > distanceComputation)
Definition:
MapFeatureBaseWithFill.java:24
com.google.appinventor.components
com.google.appinventor.components.runtime.Map.getController
MapController getController()
Definition:
Map.java:667
com.google.appinventor.components.runtime.MapFeatureBase
Definition:
MapFeatureBase.java:32
com.google.appinventor.components.runtime.MapFeatureBaseWithFill.FillOpacity
void FillOpacity(float opacity)
Definition:
MapFeatureBaseWithFill.java:55
com.google.appinventor.components.runtime.MapFeatureBase.container
MapFeatureContainer container
Definition:
MapFeatureBase.java:33
com.google.appinventor.components.runtime.Component.COLOR_RED
static final int COLOR_RED
Definition:
Component.java:65
com.google.appinventor.components.runtime.MapFeatureBase.map
Map map
Definition:
MapFeatureBase.java:34
com.google.appinventor.components.annotations.SimpleProperty
Definition:
SimpleProperty.java:23
com.google.appinventor.components.runtime.MapFeatureBaseWithFill.FillColor
int FillColor()
Definition:
MapFeatureBaseWithFill.java:47
com.google.appinventor.components.annotations.PropertyCategory
Definition:
PropertyCategory.java:13
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition:
AccelerometerSensor.java:8
com.google.appinventor.components.runtime.Component
Definition:
Component.java:17
com.google.appinventor.components.runtime.MapFeatureBaseWithFill.FillOpacity
float FillOpacity()
Definition:
MapFeatureBaseWithFill.java:68
com.google.appinventor.components.common
Definition:
ComponentCategory.java:7
com.google.appinventor.components.runtime.MapFeatureBaseWithFill.FillColor
void FillColor(int argb)
Definition:
MapFeatureBaseWithFill.java:35
com.google.appinventor.components.annotations.SimpleObject
Definition:
SimpleObject.java:23
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_COLOR
static final String PROPERTY_TYPE_COLOR
Definition:
PropertyTypeConstants.java:63
com.google
com
com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer
Definition:
MapFactory.java:800
com.google.appinventor.components.annotations.IsColor
Definition:
IsColor.java:13
com.google.appinventor.components.runtime.util.MapFactory.MapFeatureVisitor
Definition:
MapFactory.java:745
com.google.appinventor.components.annotations.PropertyCategory.APPEARANCE
APPEARANCE
Definition:
PropertyCategory.java:16
com.google.appinventor.components.common.PropertyTypeConstants
Definition:
PropertyTypeConstants.java:14
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_RED
static final String DEFAULT_VALUE_COLOR_RED
Definition:
Component.java:81
com.google.appinventor.components.annotations
com.google.appinventor
com.google.appinventor.components.runtime.MapFeatureBaseWithFill
Definition:
MapFeatureBaseWithFill.java:20
com
google
appinventor
components
runtime
MapFeatureBaseWithFill.java
Generated by
1.8.16