All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.citygml4j.model.citygml.texturedsurface._Material Maven / Gradle / Ivy

/*
 * citygml4j - The Open Source Java API for CityGML
 * https://github.com/citygml4j
 *
 * Copyright 2013-2020 Claus Nagel 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.citygml4j.model.citygml.texturedsurface;

import org.citygml4j.builder.copy.CopyBuilder;
import org.citygml4j.model.citygml.CityGMLClass;
import org.citygml4j.model.common.base.ModelObjects;
import org.citygml4j.model.common.visitor.GMLFunctor;
import org.citygml4j.model.common.visitor.GMLVisitor;

public class _Material extends _AbstractAppearance {
	private Double shininess;
	private Double transparency;
	private Double ambientIntensity;
	private _Color diffuseColor;
	private _Color emissiveColor;
	private _Color specularColor;
	
	public Double getAmbientIntensity() {
		return ambientIntensity;
	}

	public _Color getDiffuseColor() {
		return diffuseColor;
	}

	public _Color getEmissiveColor() {
		return emissiveColor;
	}

	public Double getShininess() {
		return shininess;
	}

	public _Color getSpecularColor() {
		return specularColor;
	}

	public Double getTransparency() {
		return transparency;
	}

	public boolean isSetAmbientIntensity() {
		return ambientIntensity != null;
	}

	public boolean isSetDiffuseColor() {
		return diffuseColor != null;
	}

	public boolean isSetEmissiveColor() {
		return emissiveColor != null;
	}

	public boolean isSetShininess() {
		return shininess != null;
	}

	public boolean isSetSpecularColor() {
		return specularColor != null;
	}

	public boolean isSetTransparency() {
		return transparency != null;
	}

	public void setAmbientIntensity(Double ambientIntensity) {
		this.ambientIntensity = ambientIntensity;
	}

	public void setDiffuseColor(_Color diffuseColor) {
		this.diffuseColor = ModelObjects.setParent(diffuseColor, this);
	}

	public void setEmissiveColor(_Color emissiveColor) {
		this.emissiveColor = ModelObjects.setParent(emissiveColor, this);
	}

	public void setShininess(Double shininess) {
		this.shininess = shininess;
	}

	public void setSpecularColor(_Color specularColor) {
		this.specularColor = ModelObjects.setParent(specularColor, this);
	}

	public void setTransparency(Double transparency) {
		this.transparency = transparency;
	}

	public void unsetAmbientIntensity() {
		ambientIntensity = null;
	}

	public void unsetDiffuseColor() {
		diffuseColor = ModelObjects.setNull(diffuseColor);
	}

	public void unsetEmissiveColor() {
		emissiveColor = ModelObjects.setNull(emissiveColor);
	}

	public void unsetShininess() {
		shininess = null;
	}

	public void unsetSpecularColor() {
		specularColor = ModelObjects.setNull(specularColor);
	}

	public void unsetTransparency() {
		transparency = null;
	}

	public CityGMLClass getCityGMLClass() {
		return CityGMLClass._MATERIAL;
	}

	public Object copy(CopyBuilder copyBuilder) {
		return copyTo(new _Material(), copyBuilder);
	}

	@Override
	public Object copyTo(Object target, CopyBuilder copyBuilder) {
		_Material copy = (target == null) ? new _Material() : (_Material)target;
		super.copyTo(copy, copyBuilder);
		
		if (isSetAmbientIntensity())
			copy.setAmbientIntensity((Double)copyBuilder.copy(ambientIntensity));
		
		if (isSetShininess())
			copy.setShininess((Double)copyBuilder.copy(shininess));
		
		if (isSetTransparency())
			copy.setTransparency((Double)copyBuilder.copy(transparency));
		
		if (isSetDiffuseColor()) {
			copy.setDiffuseColor((_Color)copyBuilder.copy(diffuseColor));
			if (copy.getDiffuseColor() == diffuseColor)
				diffuseColor.setParent(this);
		}
		
		if (isSetEmissiveColor()) {
			copy.setEmissiveColor((_Color)copyBuilder.copy(emissiveColor));
			if (copy.getEmissiveColor() == emissiveColor)
				emissiveColor.setParent(this);
		}
		
		if (isSetSpecularColor()) {
			copy.setSpecularColor((_Color)copyBuilder.copy(specularColor));
			if (copy.getSpecularColor() == specularColor)
				specularColor.setParent(this);
		}
		
		return copy;
	}
	
	public void accept(GMLVisitor visitor) {
		visitor.visit(this);
	}
	
	public  T accept(GMLFunctor visitor) {
		return visitor.apply(this);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy