@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getX() == null) ? 0 : getX().hashCode()); hashCode = prime * hashCode + ((getY() == null) ? 0 : getY().hashCode()); return hashCode; }
/** * <p> * Type of landmark. * </p> * * @param type * Type of landmark. * @return Returns a reference to this object so that method calls can be chained together. * @see LandmarkType */ public Landmark withType(String type) { setType(type); return this; }
/** * <p> * The x-coordinate from the top left of the landmark expressed as the ratio of the width of the image. For example, * if the image is 700 x 200 and the x-coordinate of the landmark is at 350 pixels, this value is 0.5. * </p> * * @param x * The x-coordinate from the top left of the landmark expressed as the ratio of the width of the image. For * example, if the image is 700 x 200 and the x-coordinate of the landmark is at 350 pixels, this value is * 0.5. * @return Returns a reference to this object so that method calls can be chained together. */ public Landmark withX(Float x) { setX(x); return this; }
public Landmark unmarshall(JsonUnmarshallerContext context) throws Exception { Landmark landmark = new Landmark(); if (context.testExpression("Type", targetDepth)) { context.nextToken(); landmark.setType(context.getUnmarshaller(String.class).unmarshall(context)); landmark.setX(context.getUnmarshaller(Float.class).unmarshall(context)); landmark.setY(context.getUnmarshaller(Float.class).unmarshall(context));
for (Landmark landmark : face.getLandmarks()) { int cx = (int) (landmark.getPosition().x); int cy = (int) (landmark.getPosition().y); if (landmark.getType() == 1 || landmark.getType() == 7) { canvas.drawBitmap(stickerBitmap, cx, cy, null); } }
for (int i = 0; i < faces.size(); ++i) { Face face = faces.valueAt(i); for (Landmark landmark : face.getLandmarks()) { switch (landmark.getType()) { case Landmark.LEFT_EYE: // use landmark.getPosition() as the left eye position
/** * <p> * The y-coordinate from the top left of the landmark expressed as the ratio of the height of the image. For * example, if the image is 700 x 200 and the y-coordinate of the landmark is at 100 pixels, this value is 0.5. * </p> * * @param y * The y-coordinate from the top left of the landmark expressed as the ratio of the height of the image. For * example, if the image is 700 x 200 and the y-coordinate of the landmark is at 100 pixels, this value is * 0.5. * @return Returns a reference to this object so that method calls can be chained together. */ public Landmark withY(Float y) { setY(y); return this; }
/** * <p> * Type of landmark. * </p> * * @param type * Type of landmark. * @see LandmarkType */ public void setType(LandmarkType type) { withType(type); }
public Landmark unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } Landmark landmark = new Landmark(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("Type")) { landmark.setType(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("X")) { landmark.setX(FloatJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Y")) { landmark.setY(FloatJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return landmark; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Landmark == false) return false; Landmark other = (Landmark) obj; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getX() == null ^ this.getX() == null) return false; if (other.getX() != null && other.getX().equals(this.getX()) == false) return false; if (other.getY() == null ^ this.getY() == null) return false; if (other.getY() != null && other.getY().equals(this.getY()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getType() != null) sb.append("Type: ").append(getType()).append(","); if (getX() != null) sb.append("X: ").append(getX()).append(","); if (getY() != null) sb.append("Y: ").append(getY()); sb.append("}"); return sb.toString(); }
/** * Marshall the given parameter object. */ public void marshall(Landmark landmark, ProtocolMarshaller protocolMarshaller) { if (landmark == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(landmark.getType(), TYPE_BINDING); protocolMarshaller.marshall(landmark.getX(), X_BINDING); protocolMarshaller.marshall(landmark.getY(), Y_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getX() == null) ? 0 : getX().hashCode()); hashCode = prime * hashCode + ((getY() == null) ? 0 : getY().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Landmark == false) return false; Landmark other = (Landmark) obj; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getX() == null ^ this.getX() == null) return false; if (other.getX() != null && other.getX().equals(this.getX()) == false) return false; if (other.getY() == null ^ this.getY() == null) return false; if (other.getY() != null && other.getY().equals(this.getY()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getType() != null) sb.append("Type: " + getType() + ","); if (getX() != null) sb.append("X: " + getX() + ","); if (getY() != null) sb.append("Y: " + getY()); sb.append("}"); return sb.toString(); }
public void marshall(Landmark landmark, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (landmark.getType() != null) { String type = landmark.getType(); jsonWriter.name("Type"); jsonWriter.value(type); } if (landmark.getX() != null) { Float x = landmark.getX(); jsonWriter.name("X"); jsonWriter.value(x); } if (landmark.getY() != null) { Float y = landmark.getY(); jsonWriter.name("Y"); jsonWriter.value(y); } jsonWriter.endObject(); }