有条件地改变折线颜色

时间:2016-08-05 21:08:02

标签: ios google-maps google-polyline

- (void)loadView {

// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.551927
                                                        longitude:-77.456292
                                                             zoom:18];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(37.551709, -77.456510);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hi";
marker.map = mapView;
mapView.settings.myLocationButton = YES;
mapView.myLocationEnabled = YES;
self.view = mapView;

GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(37.552243, -77.457415)];
[path addCoordinate:CLLocationCoordinate2DMake(37.551054, -77.455443)];

GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
int x = 0;
if ((x = 1)){
    polyline.spans = @[[GMSStyleSpan spanWithColor:[UIColor redColor]]];
}
else polyline.spans = @[[GMSStyleSpan spanWithColor:[UIColor greenColor]]];
polyline.strokeWidth = 10.f;
polyline.map = mapView;}

我正在尝试根据条件更改此折线的颜色。我是XCode的新手所以我只是尝试了一个if语句,但由于某种原因它不起作用。任何想法,将不胜感激!

1 个答案:

答案 0 :(得分:0)

您混合了作业和比较运算符。

reject() - >分配新值
**java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/GzipHandler** at org.apache.spark.ui.JettyUtils$$anonfun$4.apply(JettyUtils.scala:235) at org.apache.spark.ui.JettyUtils$$anonfun$4.apply(JettyUtils.scala:234) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) at scala.collection.AbstractTraversable.map(Traversable.scala:105) at org.apache.spark.ui.JettyUtils$.startJettyServer(JettyUtils.scala:234) at org.apache.spark.ui.WebUI.bind(WebUI.scala:136) at org.apache.spark.SparkContext$$anonfun$13.apply(SparkContext.scala:499) at org.apache.spark.SparkContext$$anonfun$13.apply(SparkContext.scala:499) at scala.Option.foreach(Option.scala:236) at org.apache.spark.SparkContext.<init>(SparkContext.scala:499) - &gt;检查左手和右手值是否相等

不幸的是,它仍然是一个有效的“条件”声明,尽管它意味着不同的东西。

<dependency> <groupId>io.snappydata</groupId> <artifactId>snappy-core_2.10</artifactId> <version>0.5</version> </dependency> <dependency> <groupId>io.snappydata</groupId> <artifactId>snappy-cluster_2.10</artifactId> <version>0.5</version> <dependency> @Test public void testInsertDataFromCsv() throws Exception { SparkConf conf = new SparkConf(); conf.setMaster("spark://snappy-lead-host:8090"); conf.setAppName("MySparkApp"); SparkContext sc = new SparkContext(conf); SnappyContext snappyContext = new SnappyContext(sc); String fileResource = "data.csv"; DataFrame dataFrame = snappyContext.read() .format("com.databricks.spark.csv").option("header", "true") .option("inferSchema", "true").load(fileResource); JavaRDD<Row> row = dataFrame.javaRDD(); System.out.println(row.toDebugString()); dataFrame.write().insertInto("example_table_col"); } - &gt;如果作业成功(即=中的值被认为是==
if (x = 1) - &gt;如果x等于true