text:
package ui

import (
	"bufio"
	"fmt"
	"github.com/fedux-org/local_webserver/local_webserver_lib"
	"github.com/fedux-org/local_webserver/utils"
	"net"
	"os"
	"sort"
	"strconv"
	"strings"
	"time"
)

type ByName []net.Interface

func (a ByName) Len() int           { return len(a) }
func (a ByName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByName) Less(i, j int) bool { return a[i].Name < a[j].Name }

func DeterminInterfaceToListenOn() string {
	nics, _ := net.Interfaces()
	sort.Sort(ByName(nics))

	network_interfaces := BuildInterfaceList(nics)
	chosen_interface := AskForInterface(network_interfaces)

	return network_interfaces[chosen_interface].Address()
}

func PrintInterfaceList(network_interfaces []local_webserver_lib.NetworkInterface, default_value int) {
	fmt.Println("Available Interfaces")

	number := 1
	marker := " "
	for _, network_interface := range network_interfaces {
		if default_value == number {
			marker = "*"
		} else {
			marker = " "
		}

		fmt.Printf("[%2d]%s %20s: %s\n", number, marker, network_interface.Name, network_interface.Address())
		number += 1
	}
}

func AskForInterface(network_interfaces []local_webserver_lib.NetworkInterface) (chosen_interface int) {
	default_choice := fmt.Sprintf("%d", utils.IndexOfElement("127.0.0.1", network_interfaces)+1)
	timeout := 7

	default_choice_i, _ := strconv.Atoi(default_choice)
	PrintInterfaceList(network_interfaces, default_choice_i)

	fmt.Printf("Enter Number [1-%d] (Timeout: %ds, Default: %s, Press Enter for Default): ", len(network_interfaces), timeout, default_choice)
	reader := bufio.NewReader(os.Stdin)

	c := make(chan string, 1)
	go func() {
		choice, _ := reader.ReadString('\n')
		choice = strings.TrimSpace(choice)

		if choice == "" {
			choice = default_choice
		}

		c <- choice
	}()

	var choice string

	select {
	case choice = <-c:
	case <-time.After(time.Duration(timeout) * time.Second):
		choice = default_choice
		fmt.Printf("\nTimeout occured. Choosing number %s\n", choice)
	}

	if _, err := strconv.Atoi(choice); err == nil {
		chosen_interface, _ = strconv.Atoi(choice)

		if chosen_interface > len(network_interfaces) || chosen_interface < 1 {
			fmt.Printf("[ERROR] Invalid number. Please use a number between 1 and %d\n", len(network_interfaces))
			chosen_interface = AskForInterface(network_interfaces)
		}
	} else {
		fmt.Print(err)
		fmt.Printf("[ERROR] Not a number. Please use a number between 1 and %d\n", len(network_interfaces))
		chosen_interface = AskForInterface(network_interfaces)
	}

	chosen_interface -= 1

	return
}

func BuildInterfaceList(nics []net.Interface) (network_interfaces []local_webserver_lib.NetworkInterface) {
	for _, nic := range nics {
		addrs, _ := nic.Addrs()

		for _, addr := range addrs {
			network_interfaces = append(network_interfaces, local_webserver_lib.NetworkInterface{Name: nic.Name, Network: addr.String()})
		}
	}

	if utils.IpInNetworkInterfaceSlice("127.0.0.1", network_interfaces) == false {
		network_interfaces = append(network_interfaces, local_webserver_lib.NetworkInterface{Name: "localhost", Network: "127.0.0.1"})
	}

	network_interfaces = utils.FilterElement([]string{"fe80"}, network_interfaces)

	return
}

func ListNetworkInterfaces() {
	fmt.Println("Available Network Interfaces on Host:")

	nics, _ := net.Interfaces()

	sort.Sort(ByName(nics))

	for _, nic := range nics {
		addrs, _ := nic.Addrs()

		for _, addr := range addrs {
			fmt.Printf("%10s: %s\n", nic.Name, addr.String())
		}
	}

	fmt.Println()
}


text:
#!/bin/bash
source ../testutils/utils.sh

_PWD=`pwd`
ANDROID_TOP=$_PWD/../..
APK=""
QUERY="100"

compile() # $keystore
{
    keystore="$1"
    cd $ANDROID_TOP
    . build/envsetup.sh
    cd $_PWD/$target
    cp $_PWD/../out/cafe.jar libs
    # get test package
    rm -f .install
    mm -j5 > .install 2>&1
    if [ $? -ne 0 ];then
        cat .install
        exit 1
    fi
    apk=`cat .install | grep "Install:" | awk '{print $2}'`
    APK="$ANDROID_TOP/$apk"

    if [ ! -z "$keystore" ];then
        zip -d $APK META-INF/*
        echo "jarsigner -verbose -keystore $keystore -signedjar $APK+_resigned $APK ${keystore##*/}"
        jarsigner -verbose -keystore $keystore -signedjar $APK"_resigned" $APK ${keystore##*/}
        APK=$APK"_resigned"
    fi

    rm -f .install
    mkdir -p $_PWD/out
    echo "$_PWD"
    cp $APK $_PWD/out
}

make_project()
{
	# NOTICE: $1 must ends with .apk
	path=${1%.*}
	apk_name=${path##*/}
	echo "apk_name: $apk_name"
	target_apk=$1
	dump=`aapt dump badging $target_apk`
	target_package=`echo "$dump" | grep "package: name" | awk -F "'" '{print $2}'`
	echo "target_package: $target_package"
	test_package="com.example.demo.test"
	echo "test_package: $test_package"
	launchable_class=`echo "$dump" | grep launchable | awk -F "'" '{print $2}' | head -1`
	echo "launchable_class: $launchable_class"

	# install
	ADB="adb -s $serial"
	$ADB uninstall $target_package
    echo "$ADB install $target_apk"
	$ADB install $target_apk&

	# modify template project
	project_dir="CafeRecorder"
	rm -rf $project_dir
	cp -r TestRecord $project_dir
	cd $project_dir
	sed -i 's/{test_package}/'"$test_package"'/g' AndroidManifest.xml
	sed -i 's/{target_package}/'"$target_package"'/g' AndroidManifest.xml
	sed -i 's/{test_apk}/'"Recorder"'/g' Android.mk
	main_java_file="src/com/example/demo/test/CafeReplay.java"
	sed -i 's/{launcher_class}/'"$launchable_class"'/g' "$main_java_file"
	sed -i 's/{target_package}/'"$target_package"'/g' "$main_java_file"
}

run()
{
	ADB="adb -s $serial"
	start_monkey_server "$serial"
    $ADB shell service call window 2
    $ADB shell service call window 1 i32 4939
    $ADB logcat -c
    $ADB logcat  > $serial.logcat &
    logcat_pid=$!
    echo "$ADB shell am instrument -e custom \"$QUERY\" -e class com.example.demo.test.CafeReplay#testRecorded  -w $test_package/com.baidu.cafe.CafeTestRunner"
    $ADB shell am instrument -e custom "$QUERY" -e class com.example.demo.test.CafeReplay#testRecorded  -w $test_package/com.baidu.cafe.CafeTestRunner
    kill -9 $logcat_pid
    $ADB pull /data/data/$package_name/files/$package_name.jpg .
}

serial="$2"
serial=`adb devices | grep -v List | grep device | awk -F " " '{print $1}'`
package_name="$3"
test_package="com.example.demo.test"
QUERY="$4"
echo "serial_number:$serial"
echo "package_name:$package_name"
echo "query:$QUERY"

while getopts "cardm" option
do
	case $option in
		r)
            #APK=$_PWD/$2
            test_case="test_query"
            run
			exit 0
			;;
		c)
            target="$2"
            compile
			exit 0
            ;;
        a)
            ls | grep Test | while read dir
        do
            target=$dir
            echo "compile $dir"
            compile "$dir"
        done
        exit 0
        ;;
		d)
            test_case="test_dump"
            run
			exit 0
            ;;
		m)
			make_project $2
			exit 0
            ;;
esac
done

target="$1"
compile "$2"
serial=`adb devices | grep -v List | grep device | awk -F " " '{print $1}'`
ADB="adb -s $serial"
$ADB install -r $_PWD/Cafe.apk
get_package_name "$APK"
$ADB uninstall $ret_get_package_name
$ADB install $APK
test_package=`aapt dump badging $APK | grep "package:" | awk -F "'" '{print $2}'`
echo "$test_package"
test_case="test_dump"
echo "$test_case"
QUERY="100"
echo "QUERY:$QUERY"
run

redpajama_set_name: RedPajamaGithub


text:
package com.xing.android.sdk.task.contact_petition;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.xing.android.sdk.json.user.ContactPetitionsMapper;
import com.xing.android.sdk.model.user.ContactPetition;
import com.xing.android.sdk.model.user.field.XingUserField;
import com.xing.android.sdk.network.request.ContactPetitionRequests;
import com.xing.android.sdk.task.OnTaskFinishedListener;
import com.xing.android.sdk.task.PaginatedWithOffsetTask;
import com.xing.android.sdk.task.PrioritizedRunnable.Priority;

import java.util.List;

/**
 * @author ciprian.ursu
 * @author david.gonzalez
 * @see ContactPetitionRequests#incomingContactPetitions(String, Integer, Integer, List)
 */
@SuppressWarnings("unused")
public class IncomingContactPetitionsTask extends PaginatedWithOffsetTask<List<ContactPetition>> {
    private final String mUserId;
    private final List<XingUserField> mUserFields;

    /**
     * @param userId     ID of the user whose incoming contact petitions are to be returned.
     * @param limit      Restricts the number of contact petitions to be returned. This must be a positive number. Default: 10.
     * @param offset     Offset. This must be a positive number. Default: 0.
     * @param userFields List of user attributes to return.
     * @param tag        Object that allows the task manager to cancel or stop listening ths task.
     * @param listener   Observer that will be notified with the de-serialized result in case of success, or with an exception in case of failure.
     */
    public IncomingContactPetitionsTask(@NonNull String userId,
                                        @Nullable Integer limit,
                                        @Nullable Integer offset,
                                        @Nullable List<XingUserField> userFields,
                                        @NonNull Object tag,
                                        @NonNull OnTaskFinishedListener<List<ContactPetition>> listener) {
        this(userId, limit, offset, userFields, tag, listener, null);
    }

    /**
     * @param userId     ID of the user whose incoming contact petitions are to be returned.
     * @param limit      Restricts the number of contact petitions to be returned. This must be a positive number. Default: 10.
     * @param offset     Offset. This must be a positive number. Default: 0.
     * @param userFields List of user attributes to return.
     * @param tag        Object that allows the task manager to cancel or stop listening ths task.
     * @param listener   Observer that will be notified with the de-serialized result in case of success, or with an exception in case of failure.
     * @param priority   Determines the position of the task on the queue of execution. It is a value of {@link Priority Priority}
     */
    public IncomingContactPetitionsTask(@NonNull String userId,
                                        @Nullable Integer limit,
                                        @Nullable Integer offset,
                                        @Nullable List<XingUserField> userFields,
                                        @NonNull Object tag,
                                        @NonNull OnTaskFinishedListener<List<ContactPetition>> listener,
                                        @Nullable Priority priority) {
        super(limit, offset, tag, listener, priority);
        mUserId = userId;
        mUserFields = userFields;
    }

    /**
     * Executes the {@link ContactPetitionRequests#incomingContactPetitions(String, Integer, Integer, List)}  ContactPathRequests.incomingContactPetitions} request and deserialize the result.
     *
     * @return List of incoming {@link ContactPetition contact petition}
     * @throws Exception Can be {@link com.xing.android.sdk.network.oauth.OauthSigner.XingOauthException XingOauthException},
     *                   {@link com.xing.android.sdk.network.request.exception.NetworkException NetworkException}
     *                   or {@link com.xing.android.sdk.json.XingJsonException XingJsonException}.
     */
    @Override
    public List<ContactPetition> run() throws Exception {
        String response = ContactPetitionRequests.incomingContactPetitions(mUserId,
                mLimit, mOffset, mUserFields);

        return ContactPetitionsMapper.parseContactPetitionList(response);
    }
}


text:
package org.keycloak.testsuite.util;

import org.jboss.logging.Logger;
import org.keycloak.constants.KerberosConstants;
import org.keycloak.models.LDAPConstants;
import org.keycloak.models.UserFederationProvider;

import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * @author Marek Posolda
 */
public class LDAPTestConfiguration {

    private static final Logger log = Logger.getLogger(LDAPTestConfiguration.class);

    private String connectionPropertiesLocation;
    private boolean startEmbeddedLdapLerver = true;
    private Map<String, String> config;

    protected static final Map<String, String> PROP_MAPPINGS = new HashMap<String, String>();
    protected static final Map<String, String> DEFAULT_VALUES = new HashMap<String, String>();

    static {
        PROP_MAPPINGS.put(LDAPConstants.CONNECTION_URL, "idm.test.ldap.connection.url");
        PROP_MAPPINGS.put(LDAPConstants.BASE_DN, "idm.test.ldap.base.dn");
        PROP_MAPPINGS.put(LDAPConstants.USERS_DN, "idm.test.ldap.user.dn.suffix");
        PROP_MAPPINGS.put(LDAPConstants.BIND_DN, "idm.test.ldap.bind.dn");
        PROP_MAPPINGS.put(LDAPConstants.BIND_CREDENTIAL, "idm.test.ldap.bind.credential");
        PROP_MAPPINGS.put(LDAPConstants.VENDOR, "idm.test.ldap.vendor");
        PROP_MAPPINGS.put(LDAPConstants.CONNECTION_POOLING, "idm.test.ldap.connection.pooling");
        PROP_MAPPINGS.put(LDAPConstants.PAGINATION, "idm.test.ldap.pagination");
        PROP_MAPPINGS.put(LDAPConstants.BATCH_SIZE_FOR_SYNC, "idm.test.ldap.batch.size.for.sync");
        PROP_MAPPINGS.put(LDAPConstants.USERNAME_LDAP_ATTRIBUTE, "idm.test.ldap.username.ldap.attribute");
        PROP_MAPPINGS.put(LDAPConstants.RDN_LDAP_ATTRIBUTE, "idm.test.ldap.rdn.ldap.attribute");
        PROP_MAPPINGS.put(LDAPConstants.USER_OBJECT_CLASSES, "idm.test.ldap.user.object.classes");
        PROP_MAPPINGS.put(LDAPConstants.USER_ACCOUNT_CONTROLS_AFTER_PASSWORD_UPDATE, "idm.test.ldap.user.account.controls.after.password.update");
        PROP_MAPPINGS.put(LDAPConstants.EDIT_MODE, "idm.test.ldap.edit.mode");

        PROP_MAPPINGS.put(KerberosConstants.ALLOW_KERBEROS_AUTHENTICATION, "idm.test.kerberos.allow.kerberos.authentication");
        PROP_MAPPINGS.put(KerberosConstants.KERBEROS_REALM, "idm.test.kerberos.realm");
        PROP_MAPPINGS.put(KerberosConstants.SERVER_PRINCIPAL, "idm.test.kerberos.server.principal");
        PROP_MAPPINGS.put(KerberosConstants.KEYTAB, "idm.test.kerberos.keytab");
        PROP_MAPPINGS.put(KerberosConstants.DEBUG, "idm.test.kerberos.debug");
        PROP_MAPPINGS.put(KerberosConstants.ALLOW_PASSWORD_AUTHENTICATION, "idm.test.kerberos.allow.password.authentication");
        PROP_MAPPINGS.put(KerberosConstants.UPDATE_PROFILE_FIRST_LOGIN, "idm.test.kerberos.update.profile.first.login");
        PROP_MAPPINGS.put(KerberosConstants.USE_KERBEROS_FOR_PASSWORD_AUTHENTICATION, "idm.test.kerberos.use.kerberos.for.password.authentication");

        DEFAULT_VALUES.put(LDAPConstants.CONNECTION_URL, "ldap://localhost:10389");
        DEFAULT_VALUES.put(LDAPConstants.BASE_DN, "dc=keycloak,dc=org");
        DEFAULT_VALUES.put(LDAPConstants.USERS_DN, "ou=People,dc=keycloak,dc=org");
        DEFAULT_VALUES.put(LDAPConstants.BIND_DN, "uid=admin,ou=system");
        DEFAULT_VALUES.put(LDAPConstants.BIND_CREDENTIAL, "secret");
        DEFAULT_VALUES.put(LDAPConstants.VENDOR, LDAPConstants.VENDOR_OTHER);
        DEFAULT_VALUES.put(LDAPConstants.CONNECTION_POOLING, "true");
        DEFAULT_VALUES.put(LDAPConstants.PAGINATION, "true");
        DEFAULT_VALUES.put(LDAPConstants.BATCH_SIZE_FOR_SYNC, String.valueOf(LDAPConstants.DEFAULT_BATCH_SIZE_FOR_SYNC));
        DEFAULT_VALUES.put(LDAPConstants.USERNAME_LDAP_ATTRIBUTE, null);
        DEFAULT_VALUES.put(LDAPConstants.USER_OBJECT_CLASSES, null);
        DEFAULT_VALUES.put(LDAPConstants.USER_ACCOUNT_CONTROLS_AFTER_PASSWORD_UPDATE, "false");
        DEFAULT_VALUES.put(LDAPConstants.EDIT_MODE, UserFederationProvider.EditMode.READ_ONLY.toString());

        DEFAULT_VALUES.put(KerberosConstants.ALLOW_KERBEROS_AUTHENTICATION, "false");
        DEFAULT_VALUES.put(KerberosConstants.KERBEROS_REALM, "KEYCLOAK.ORG");
        DEFAULT_VALUES.put(KerberosConstants.SERVER_PRINCIPAL, "HTTP/localhost@KEYCLOAK.ORG");
        URL keytabUrl = LDAPTestConfiguration.class.getResource("/kerberos/http.keytab");
        String keyTabPath = new File(keytabUrl.getFile()).getAbsolutePath();
        DEFAULT_VALUES.put(KerberosConstants.KEYTAB, keyTabPath);
        DEFAULT_VALUES.put(KerberosConstants.DEBUG, "true");
        DEFAULT_VALUES.put(KerberosConstants.ALLOW_PASSWORD_AUTHENTICATION, "true");
        DEFAULT_VALUES.put(KerberosConstants.UPDATE_PROFILE_FIRST_LOGIN, "true");
        DEFAULT_VALUES.put(KerberosConstants.USE_KERBEROS_FOR_PASSWORD_AUTHENTICATION, "false");
    }

    public static LDAPTestConfiguration readConfiguration(String connectionPropertiesLocation) {
        LDAPTestConfiguration ldapTestConfiguration = new LDAPTestConfiguration();
        ldapTestConfiguration.setConnectionPropertiesLocation(connectionPropertiesLocation);
        ldapTestConfiguration.loadConnectionProperties();
        return ldapTestConfiguration;
    }

    protected void loadConnectionProperties() {
        Properties p = new Properties();
        try {
            log.info("Reading LDAP configuration from: " + connectionPropertiesLocation);
            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(connectionPropertiesLocation);
            p.load(is);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }

        config = new HashMap<String, String>();
        for (Map.Entry<String, String> property : PROP_MAPPINGS.entrySet()) {
            String propertyName = property.getKey();
            String configName = property.getValue();

            String value = (String) p.get(configName);
            if (value == null) {
                value = DEFAULT_VALUES.get(propertyName);
            }

            config.put(propertyName, value);
        }

        startEmbeddedLdapLerver = Boolean.parseBoolean(p.getProperty("idm.test.ldap.start.embedded.ldap.server", "true"));
        log.info("Start embedded server: " + startEmbeddedLdapLerver);
        log.info("Read config: " + config);
    }

    public Map<String,String> getLDAPConfig() {
        return config;
    }

    public void setConnectionPropertiesLocation(String connectionPropertiesLocation) {
        this.connectionPropertiesLocation = connectionPropertiesLocation;
    }

    public boolean isStartEmbeddedLdapLerver() {
        return startEmbeddedLdapLerver;
    }

}


text:
Reads a JSON file and then parses it into an object. `options` are the same
that you'd pass to [`jsonFile.readFileSync`](https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options).

**Alias:** `readJSONSync()`

- `file` `<String>`
- `options` `<Object>`

## Example:

```js
const fs = require('fs-extra')

const packageObj = fs.readJsonSync('./package.json')
console.log(packageObj.version) // => 2.0.0
```

---

`readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example:

```js
const fs = require('fs-extra')

const file = '/tmp/some-invalid.json'
const data = '{not valid JSON'
fs.writeFileSync(file, data)

const obj = fs.readJsonSync(file, { throws: false })
console.log(obj) // => null
```


text:
use vk::*;

#[repr(C)]
#[derive(Copy, Clone)]
pub struct ApplicationInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub pApplicationName: *const ::std::os::raw::c_char,
    pub applicationVersion: u32,
    pub pEngineName: *const ::std::os::raw::c_char,
    pub engineVersion: u32,
    pub apiVersion: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct InstanceCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: InstanceCreateFlags,
    pub pApplicationInfo: *const ApplicationInfo,
    pub enabledLayerCount: u32,
    pub ppEnabledLayerNames: *const *const ::std::os::raw::c_char,
    pub enabledExtensionCount: u32,
    pub ppEnabledExtensionNames: *const *const ::std::os::raw::c_char,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AllocationCallbacks {
    pub pUserData: *mut ::std::os::raw::c_void,
    pub pfnAllocation: PFN_vkAllocationFunction,
    pub pfnReallocation: PFN_vkReallocationFunction,
    pub pfnFree: PFN_vkFreeFunction,
    pub pfnInternalAllocation: PFN_vkInternalAllocationNotification,
    pub pfnInternalFree: PFN_vkInternalFreeNotification,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PhysicalDeviceFeatures {
    pub robustBufferAccess: Bool32,
    pub fullDrawIndexUint32: Bool32,
    pub imageCubeArray: Bool32,
    pub independentBlend: Bool32,
    pub geometryShader: Bool32,
    pub tessellationShader: Bool32,
    pub sampleRateShading: Bool32,
    pub dualSrcBlend: Bool32,
    pub logicOp: Bool32,
    pub multiDrawIndirect: Bool32,
    pub drawIndirectFirstInstance: Bool32,
    pub depthClamp: Bool32,
    pub depthBiasClamp: Bool32,
    pub fillModeNonSolid: Bool32,
    pub depthBounds: Bool32,
    pub wideLines: Bool32,
    pub largePoints: Bool32,
    pub alphaToOne: Bool32,
    pub multiViewport: Bool32,
    pub samplerAnisotropy: Bool32,
    pub textureCompressionETC2: Bool32,
    pub textureCompressionASTC_LDR: Bool32,
    pub textureCompressionBC: Bool32,
    pub occlusionQueryPrecise: Bool32,
    pub pipelineStatisticsQuery: Bool32,
    pub vertexPipelineStoresAndAtomics: Bool32,
    pub fragmentStoresAndAtomics: Bool32,
    pub shaderTessellationAndGeometryPointSize: Bool32,
    pub shaderImageGatherExtended: Bool32,
    pub shaderStorageImageExtendedFormats: Bool32,
    pub shaderStorageImageMultisample: Bool32,
    pub shaderStorageImageReadWithoutFormat: Bool32,
    pub shaderStorageImageWriteWithoutFormat: Bool32,
    pub shaderUniformBufferArrayDynamicIndexing: Bool32,
    pub shaderSampledImageArrayDynamicIndexing: Bool32,
    pub shaderStorageBufferArrayDynamicIndexing: Bool32,
    pub shaderStorageImageArrayDynamicIndexing: Bool32,
    pub shaderClipDistance: Bool32,
    pub shaderCullDistance: Bool32,
    pub shaderFloat64: Bool32,
    pub shaderInt64: Bool32,
    pub shaderInt16: Bool32,
    pub shaderResourceResidency: Bool32,
    pub shaderResourceMinLod: Bool32,
    pub sparseBinding: Bool32,
    pub sparseResidencyBuffer: Bool32,
    pub sparseResidencyImage2D: Bool32,
    pub sparseResidencyImage3D: Bool32,
    pub sparseResidency2Samples: Bool32,
    pub sparseResidency4Samples: Bool32,
    pub sparseResidency8Samples: Bool32,
    pub sparseResidency16Samples: Bool32,
    pub sparseResidencyAliased: Bool32,
    pub variableMultisampleRate: Bool32,
    pub inheritedQueries: Bool32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct FormatProperties {
    pub linearTilingFeatures: FormatFeatureFlags,
    pub optimalTilingFeatures: FormatFeatureFlags,
    pub bufferFeatures: FormatFeatureFlags,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct Extent3D {
    pub width: u32,
    pub height: u32,
    pub depth: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageFormatProperties {
    pub maxExtent: Extent3D,
    pub maxMipLevels: u32,
    pub maxArrayLayers: u32,
    pub sampleCounts: SampleCountFlags,
    pub maxResourceSize: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PhysicalDeviceLimits {
    pub maxImageDimension1D: u32,
    pub maxImageDimension2D: u32,
    pub maxImageDimension3D: u32,
    pub maxImageDimensionCube: u32,
    pub maxImageArrayLayers: u32,
    pub maxTexelBufferElements: u32,
    pub maxUniformBufferRange: u32,
    pub maxStorageBufferRange: u32,
    pub maxPushConstantsSize: u32,
    pub maxMemoryAllocationCount: u32,
    pub maxSamplerAllocationCount: u32,
    pub bufferImageGranularity: DeviceSize,
    pub sparseAddressSpaceSize: DeviceSize,
    pub maxBoundDescriptorSets: u32,
    pub maxPerStageDescriptorSamplers: u32,
    pub maxPerStageDescriptorUniformBuffers: u32,
    pub maxPerStageDescriptorStorageBuffers: u32,
    pub maxPerStageDescriptorSampledImages: u32,
    pub maxPerStageDescriptorStorageImages: u32,
    pub maxPerStageDescriptorInputAttachments: u32,
    pub maxPerStageResources: u32,
    pub maxDescriptorSetSamplers: u32,
    pub maxDescriptorSetUniformBuffers: u32,
    pub maxDescriptorSetUniformBuffersDynamic: u32,
    pub maxDescriptorSetStorageBuffers: u32,
    pub maxDescriptorSetStorageBuffersDynamic: u32,
    pub maxDescriptorSetSampledImages: u32,
    pub maxDescriptorSetStorageImages: u32,
    pub maxDescriptorSetInputAttachments: u32,
    pub maxVertexInputAttributes: u32,
    pub maxVertexInputBindings: u32,
    pub maxVertexInputAttributeOffset: u32,
    pub maxVertexInputBindingStride: u32,
    pub maxVertexOutputComponents: u32,
    pub maxTessellationGenerationLevel: u32,
    pub maxTessellationPatchSize: u32,
    pub maxTessellationControlPerVertexInputComponents: u32,
    pub maxTessellationControlPerVertexOutputComponents: u32,
    pub maxTessellationControlPerPatchOutputComponents: u32,
    pub maxTessellationControlTotalOutputComponents: u32,
    pub maxTessellationEvaluationInputComponents: u32,
    pub maxTessellationEvaluationOutputComponents: u32,
    pub maxGeometryShaderInvocations: u32,
    pub maxGeometryInputComponents: u32,
    pub maxGeometryOutputComponents: u32,
    pub maxGeometryOutputVertices: u32,
    pub maxGeometryTotalOutputComponents: u32,
    pub maxFragmentInputComponents: u32,
    pub maxFragmentOutputAttachments: u32,
    pub maxFragmentDualSrcAttachments: u32,
    pub maxFragmentCombinedOutputResources: u32,
    pub maxComputeSharedMemorySize: u32,
    pub maxComputeWorkGroupCount: [u32; 3usize],
    pub maxComputeWorkGroupInvocations: u32,
    pub maxComputeWorkGroupSize: [u32; 3usize],
    pub subPixelPrecisionBits: u32,
    pub subTexelPrecisionBits: u32,
    pub mipmapPrecisionBits: u32,
    pub maxDrawIndexedIndexValue: u32,
    pub maxDrawIndirectCount: u32,
    pub maxSamplerLodBias: ::std::os::raw::c_float,
    pub maxSamplerAnisotropy: ::std::os::raw::c_float,
    pub maxViewports: u32,
    pub maxViewportDimensions: [u32; 2usize],
    pub viewportBoundsRange: [::std::os::raw::c_float; 2usize],
    pub viewportSubPixelBits: u32,
    pub minMemoryMapAlignment: usize,
    pub minTexelBufferOffsetAlignment: DeviceSize,
    pub minUniformBufferOffsetAlignment: DeviceSize,
    pub minStorageBufferOffsetAlignment: DeviceSize,
    pub minTexelOffset: i32,
    pub maxTexelOffset: u32,
    pub minTexelGatherOffset: i32,
    pub maxTexelGatherOffset: u32,
    pub minInterpolationOffset: ::std::os::raw::c_float,
    pub maxInterpolationOffset: ::std::os::raw::c_float,
    pub subPixelInterpolationOffsetBits: u32,
    pub maxFramebufferWidth: u32,
    pub maxFramebufferHeight: u32,
    pub maxFramebufferLayers: u32,
    pub framebufferColorSampleCounts: SampleCountFlags,
    pub framebufferDepthSampleCounts: SampleCountFlags,
    pub framebufferStencilSampleCounts: SampleCountFlags,
    pub framebufferNoAttachmentsSampleCounts: SampleCountFlags,
    pub maxColorAttachments: u32,
    pub sampledImageColorSampleCounts: SampleCountFlags,
    pub sampledImageIntegerSampleCounts: SampleCountFlags,
    pub sampledImageDepthSampleCounts: SampleCountFlags,
    pub sampledImageStencilSampleCounts: SampleCountFlags,
    pub storageImageSampleCounts: SampleCountFlags,
    pub maxSampleMaskWords: u32,
    pub timestampComputeAndGraphics: Bool32,
    pub timestampPeriod: ::std::os::raw::c_float,
    pub maxClipDistances: u32,
    pub maxCullDistances: u32,
    pub maxCombinedClipAndCullDistances: u32,
    pub discreteQueuePriorities: u32,
    pub pointSizeRange: [::std::os::raw::c_float; 2usize],
    pub lineWidthRange: [::std::os::raw::c_float; 2usize],
    pub pointSizeGranularity: ::std::os::raw::c_float,
    pub lineWidthGranularity: ::std::os::raw::c_float,
    pub strictLines: Bool32,
    pub standardSampleLocations: Bool32,
    pub optimalBufferCopyOffsetAlignment: DeviceSize,
    pub optimalBufferCopyRowPitchAlignment: DeviceSize,
    pub nonCoherentAtomSize: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PhysicalDeviceSparseProperties {
    pub residencyStandard2DBlockShape: Bool32,
    pub residencyStandard2DMultisampleBlockShape: Bool32,
    pub residencyStandard3DBlockShape: Bool32,
    pub residencyAlignedMipSize: Bool32,
    pub residencyNonResidentStrict: Bool32,
}
#[repr(C)]
#[derive(Copy)]
pub struct PhysicalDeviceProperties {
    pub apiVersion: u32,
    pub driverVersion: u32,
    pub vendorID: u32,
    pub deviceID: u32,
    pub deviceType: PhysicalDeviceType,
    pub deviceName: [::std::os::raw::c_char; 256usize],
    pub pipelineCacheUUID: [u8; 16usize],
    pub limits: PhysicalDeviceLimits,
    pub sparseProperties: PhysicalDeviceSparseProperties,
}
impl Clone for PhysicalDeviceProperties {
    fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct QueueFamilyProperties {
    pub queueFlags: QueueFlags,
    pub queueCount: u32,
    pub timestampValidBits: u32,
    pub minImageTransferGranularity: Extent3D,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MemoryType {
    pub propertyFlags: MemoryPropertyFlags,
    pub heapIndex: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MemoryHeap {
    pub size: DeviceSize,
    pub flags: MemoryHeapFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PhysicalDeviceMemoryProperties {
    pub memoryTypeCount: u32,
    pub memoryTypes: [MemoryType; 32usize],
    pub memoryHeapCount: u32,
    pub memoryHeaps: [MemoryHeap; 16usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DeviceQueueCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: DeviceQueueCreateFlags,
    pub queueFamilyIndex: u32,
    pub queueCount: u32,
    pub pQueuePriorities: *const ::std::os::raw::c_float,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DeviceCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: DeviceCreateFlags,
    pub queueCreateInfoCount: u32,
    pub pQueueCreateInfos: *const DeviceQueueCreateInfo,
    pub enabledLayerCount: u32,
    pub ppEnabledLayerNames: *const *const ::std::os::raw::c_char,
    pub enabledExtensionCount: u32,
    pub ppEnabledExtensionNames: *const *const ::std::os::raw::c_char,
    pub pEnabledFeatures: *const PhysicalDeviceFeatures,
}
#[repr(C)]
#[derive(Copy)]
pub struct ExtensionProperties {
    pub extensionName: [::std::os::raw::c_char; 256usize],
    pub specVersion: u32,
}
impl Clone for ExtensionProperties {
    fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Copy)]
pub struct LayerProperties {
    pub layerName: [::std::os::raw::c_char; 256usize],
    pub specVersion: u32,
    pub implementationVersion: u32,
    pub description: [::std::os::raw::c_char; 256usize],
}
impl Clone for LayerProperties {
    fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SubmitInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub waitSemaphoreCount: u32,
    pub pWaitSemaphores: *const Semaphore,
    pub pWaitDstStageMask: *const PipelineStageFlags,
    pub commandBufferCount: u32,
    pub pCommandBuffers: *const CommandBuffer,
    pub signalSemaphoreCount: u32,
    pub pSignalSemaphores: *const Semaphore,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MemoryAllocateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub allocationSize: DeviceSize,
    pub memoryTypeIndex: u32,
}
#[repr(C)]
pub struct MappedMemoryRange {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub memory: DeviceMemory,
    pub offset: DeviceSize,
    pub size: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MemoryRequirements {
    pub size: DeviceSize,
    pub alignment: DeviceSize,
    pub memoryTypeBits: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SparseImageFormatProperties {
    pub aspectMask: ImageAspectFlags,
    pub imageGranularity: Extent3D,
    pub flags: SparseImageFormatFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SparseImageMemoryRequirements {
    pub formatProperties: SparseImageFormatProperties,
    pub imageMipTailFirstLod: u32,
    pub imageMipTailSize: DeviceSize,
    pub imageMipTailOffset: DeviceSize,
    pub imageMipTailStride: DeviceSize,
}
#[repr(C)]
pub struct SparseMemoryBind {
    pub resourceOffset: DeviceSize,
    pub size: DeviceSize,
    pub memory: DeviceMemory,
    pub memoryOffset: DeviceSize,
    pub flags: SparseMemoryBindFlags,
}
#[repr(C)]
pub struct SparseBufferMemoryBindInfo {
    pub buffer: Buffer,
    pub bindCount: u32,
    pub pBinds: *const SparseMemoryBind,
}
#[repr(C)]
pub struct SparseImageOpaqueMemoryBindInfo {
    pub image: Image,
    pub bindCount: u32,
    pub pBinds: *const SparseMemoryBind,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageSubresource {
    pub aspectMask: ImageAspectFlags,
    pub mipLevel: u32,
    pub arrayLayer: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct Offset3D {
    pub x: i32,
    pub y: i32,
    pub z: i32,
}
#[repr(C)]
pub struct SparseImageMemoryBind {
    pub subresource: ImageSubresource,
    pub offset: Offset3D,
    pub extent: Extent3D,
    pub memory: DeviceMemory,
    pub memoryOffset: DeviceSize,
    pub flags: SparseMemoryBindFlags,
}
#[repr(C)]
pub struct SparseImageMemoryBindInfo {
    pub image: Image,
    pub bindCount: u32,
    pub pBinds: *const SparseImageMemoryBind,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BindSparseInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub waitSemaphoreCount: u32,
    pub pWaitSemaphores: *const Semaphore,
    pub bufferBindCount: u32,
    pub pBufferBinds: *const SparseBufferMemoryBindInfo,
    pub imageOpaqueBindCount: u32,
    pub pImageOpaqueBinds: *const SparseImageOpaqueMemoryBindInfo,
    pub imageBindCount: u32,
    pub pImageBinds: *const SparseImageMemoryBindInfo,
    pub signalSemaphoreCount: u32,
    pub pSignalSemaphores: *const Semaphore,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct FenceCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: FenceCreateFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SemaphoreCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: SemaphoreCreateFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct EventCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: EventCreateFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct QueryPoolCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: QueryPoolCreateFlags,
    pub queryType: QueryType,
    pub queryCount: u32,
    pub pipelineStatistics: QueryPipelineStatisticFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BufferCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: BufferCreateFlags,
    pub size: DeviceSize,
    pub usage: BufferUsageFlags,
    pub sharingMode: SharingMode,
    pub queueFamilyIndexCount: u32,
    pub pQueueFamilyIndices: *const u32,
}
#[repr(C)]
pub struct BufferViewCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: BufferViewCreateFlags,
    pub buffer: Buffer,
    pub format: Format,
    pub offset: DeviceSize,
    pub range: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ImageCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: ImageCreateFlags,
    pub imageType: ImageType,
    pub format: Format,
    pub extent: Extent3D,
    pub mipLevels: u32,
    pub arrayLayers: u32,
    pub samples: SampleCountFlags,
    pub tiling: ImageTiling,
    pub usage: ImageUsageFlags,
    pub sharingMode: SharingMode,
    pub queueFamilyIndexCount: u32,
    pub pQueueFamilyIndices: *const u32,
    pub initialLayout: ImageLayout,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SubresourceLayout {
    pub offset: DeviceSize,
    pub size: DeviceSize,
    pub rowPitch: DeviceSize,
    pub arrayPitch: DeviceSize,
    pub depthPitch: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ComponentMapping {
    pub r: ComponentSwizzle,
    pub g: ComponentSwizzle,
    pub b: ComponentSwizzle,
    pub a: ComponentSwizzle,
}
impl Default for ComponentMapping {
    fn default() -> Self {
        ComponentMapping {
            r: ComponentSwizzle::R,
            g: ComponentSwizzle::G,
            b: ComponentSwizzle::B,
            a: ComponentSwizzle::A,
        }
    }
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageSubresourceRange {
    pub aspectMask: ImageAspectFlags,
    pub baseMipLevel: u32,
    pub levelCount: u32,
    pub baseArrayLayer: u32,
    pub layerCount: u32,
}
#[repr(C)]
pub struct ImageViewCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: ImageViewCreateFlags,
    pub image: Image,
    pub viewType: ImageViewType,
    pub format: Format,
    pub components: ComponentMapping,
    pub subresourceRange: ImageSubresourceRange,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ShaderModuleCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: ShaderModuleCreateFlags,
    pub codeSize: usize,
    pub pCode: *const u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineCacheCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineCacheCreateFlags,
    pub initialDataSize: usize,
    pub pInitialData: *const ::std::os::raw::c_void,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SpecializationMapEntry {
    pub constantID: u32,
    pub offset: u32,
    pub size: usize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SpecializationInfo {
    pub mapEntryCount: u32,
    pub pMapEntries: *const SpecializationMapEntry,
    pub dataSize: usize,
    pub pData: *const ::std::os::raw::c_void,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineShaderStageCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineShaderStageCreateFlags,
    pub stage: ShaderStageFlags,
    pub module: ShaderModule,
    pub pName: *const ::std::os::raw::c_char,
    pub pSpecializationInfo: *const SpecializationInfo,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct VertexInputBindingDescription {
    pub binding: u32,
    pub stride: u32,
    pub inputRate: VertexInputRate,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct VertexInputAttributeDescription {
    pub location: u32,
    pub binding: u32,
    pub format: Format,
    pub offset: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineVertexInputStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineVertexInputStateCreateFlags,
    pub vertexBindingDescriptionCount: u32,
    pub pVertexBindingDescriptions: *const VertexInputBindingDescription,
    pub vertexAttributeDescriptionCount: u32,
    pub pVertexAttributeDescriptions: *const VertexInputAttributeDescription,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineInputAssemblyStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineInputAssemblyStateCreateFlags,
    pub topology: PrimitiveTopology,
    pub primitiveRestartEnable: Bool32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineTessellationStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineTessellationStateCreateFlags,
    pub patchControlPoints: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct Viewport {
    pub x: ::std::os::raw::c_float,
    pub y: ::std::os::raw::c_float,
    pub width: ::std::os::raw::c_float,
    pub height: ::std::os::raw::c_float,
    pub minDepth: ::std::os::raw::c_float,
    pub maxDepth: ::std::os::raw::c_float,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct Offset2D {
    pub x: i32,
    pub y: i32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Default)]
pub struct Extent2D {
    pub width: u32,
    pub height: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct Rect2D {
    pub offset: Offset2D,
    pub extent: Extent2D,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineViewportStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineViewportStateCreateFlags,
    pub viewportCount: u32,
    pub pViewports: *const Viewport,
    pub scissorCount: u32,
    pub pScissors: *const Rect2D,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineRasterizationStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineRasterizationStateCreateFlags,
    pub depthClampEnable: Bool32,
    pub rasterizerDiscardEnable: Bool32,
    pub polygonMode: PolygonMode,
    pub cullMode: CullModeFlags,
    pub frontFace: FrontFace,
    pub depthBiasEnable: Bool32,
    pub depthBiasConstantFactor: ::std::os::raw::c_float,
    pub depthBiasClamp: ::std::os::raw::c_float,
    pub depthBiasSlopeFactor: ::std::os::raw::c_float,
    pub lineWidth: ::std::os::raw::c_float,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineMultisampleStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineMultisampleStateCreateFlags,
    pub rasterizationSamples: SampleCountFlags,
    pub sampleShadingEnable: Bool32,
    pub minSampleShading: ::std::os::raw::c_float,
    pub pSampleMask: *const SampleMask,
    pub alphaToCoverageEnable: Bool32,
    pub alphaToOneEnable: Bool32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct StencilOpState {
    pub failOp: StencilOp,
    pub passOp: StencilOp,
    pub depthFailOp: StencilOp,
    pub compareOp: CompareOp,
    pub compareMask: u32,
    pub writeMask: u32,
    pub reference: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineDepthStencilStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineDepthStencilStateCreateFlags,
    pub depthTestEnable: Bool32,
    pub depthWriteEnable: Bool32,
    pub depthCompareOp: CompareOp,
    pub depthBoundsTestEnable: Bool32,
    pub stencilTestEnable: Bool32,
    pub front: StencilOpState,
    pub back: StencilOpState,
    pub minDepthBounds: ::std::os::raw::c_float,
    pub maxDepthBounds: ::std::os::raw::c_float,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineColorBlendAttachmentState {
    pub blendEnable: Bool32,
    pub srcColorBlendFactor: BlendFactor,
    pub dstColorBlendFactor: BlendFactor,
    pub colorBlendOp: BlendOp,
    pub srcAlphaBlendFactor: BlendFactor,
    pub dstAlphaBlendFactor: BlendFactor,
    pub alphaBlendOp: BlendOp,
    pub colorWriteMask: ColorComponentFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineColorBlendStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineColorBlendStateCreateFlags,
    pub logicOpEnable: Bool32,
    pub logicOp: LogicOp,
    pub attachmentCount: u32,
    pub pAttachments: *const PipelineColorBlendAttachmentState,
    pub blendConstants: [::std::os::raw::c_float; 4usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineDynamicStateCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineDynamicStateCreateFlags,
    pub dynamicStateCount: u32,
    pub pDynamicStates: *const DynamicState,
}
#[repr(C)]
pub struct GraphicsPipelineCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineCreateFlags,
    pub stageCount: u32,
    pub pStages: *const PipelineShaderStageCreateInfo,
    pub pVertexInputState: *const PipelineVertexInputStateCreateInfo,
    pub pInputAssemblyState: *const PipelineInputAssemblyStateCreateInfo,
    pub pTessellationState: *const PipelineTessellationStateCreateInfo,
    pub pViewportState: *const PipelineViewportStateCreateInfo,
    pub pRasterizationState: *const PipelineRasterizationStateCreateInfo,
    pub pMultisampleState: *const PipelineMultisampleStateCreateInfo,
    pub pDepthStencilState: *const PipelineDepthStencilStateCreateInfo,
    pub pColorBlendState: *const PipelineColorBlendStateCreateInfo,
    pub pDynamicState: *const PipelineDynamicStateCreateInfo,
    pub layout: PipelineLayout,
    pub renderPass: RenderPass,
    pub subpass: u32,
    pub basePipelineHandle: Pipeline,
    pub basePipelineIndex: i32,
}
#[repr(C)]
pub struct ComputePipelineCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineCreateFlags,
    pub stage: PipelineShaderStageCreateInfo,
    pub layout: PipelineLayout,
    pub basePipelineHandle: Pipeline,
    pub basePipelineIndex: i32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PushConstantRange {
    pub stageFlags: ShaderStageFlags,
    pub offset: u32,
    pub size: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PipelineLayoutCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: PipelineLayoutCreateFlags,
    pub setLayoutCount: u32,
    pub pSetLayouts: *const DescriptorSetLayout,
    pub pushConstantRangeCount: u32,
    pub pPushConstantRanges: *const PushConstantRange,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SamplerCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: SamplerCreateFlags,
    pub magFilter: Filter,
    pub minFilter: Filter,
    pub mipmapMode: SamplerMipmapMode,
    pub addressModeU: SamplerAddressMode,
    pub addressModeV: SamplerAddressMode,
    pub addressModeW: SamplerAddressMode,
    pub mipLodBias: ::std::os::raw::c_float,
    pub anisotropyEnable: Bool32,
    pub maxAnisotropy: ::std::os::raw::c_float,
    pub compareEnable: Bool32,
    pub compareOp: CompareOp,
    pub minLod: ::std::os::raw::c_float,
    pub maxLod: ::std::os::raw::c_float,
    pub borderColor: BorderColor,
    pub unnormalizedCoordinates: Bool32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DescriptorSetLayoutBinding {
    pub binding: u32,
    pub descriptorType: DescriptorType,
    pub descriptorCount: u32,
    pub stageFlags: ShaderStageFlags,
    pub pImmutableSamplers: *const Sampler,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DescriptorSetLayoutCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: DescriptorSetLayoutCreateFlags,
    pub bindingCount: u32,
    pub pBindings: *const DescriptorSetLayoutBinding,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DescriptorPoolSize {
    pub typ: DescriptorType,
    pub descriptorCount: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DescriptorPoolCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: DescriptorPoolCreateFlags,
    pub maxSets: u32,
    pub poolSizeCount: u32,
    pub pPoolSizes: *const DescriptorPoolSize,
}
#[repr(C)]
pub struct DescriptorSetAllocateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub descriptorPool: DescriptorPool,
    pub descriptorSetCount: u32,
    pub pSetLayouts: *const DescriptorSetLayout,
}
#[repr(C)]
pub struct DescriptorImageInfo {
    pub sampler: Sampler,
    pub imageView: ImageView,
    pub imageLayout: ImageLayout,
}
#[repr(C)]
pub struct DescriptorBufferInfo {
    pub buffer: Buffer,
    pub offset: DeviceSize,
    pub range: DeviceSize,
}
#[repr(C)]
pub struct WriteDescriptorSet {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub dstSet: DescriptorSet,
    pub dstBinding: u32,
    pub dstArrayElement: u32,
    pub descriptorCount: u32,
    pub descriptorType: DescriptorType,
    pub pImageInfo: *const DescriptorImageInfo,
    pub pBufferInfo: *const DescriptorBufferInfo,
    pub pTexelBufferView: *const BufferView,
}
#[repr(C)]
pub struct CopyDescriptorSet {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub srcSet: DescriptorSet,
    pub srcBinding: u32,
    pub srcArrayElement: u32,
    pub dstSet: DescriptorSet,
    pub dstBinding: u32,
    pub dstArrayElement: u32,
    pub descriptorCount: u32,
}
#[repr(C)]
pub struct FramebufferCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: FramebufferCreateFlags,
    pub renderPass: RenderPass,
    pub attachmentCount: u32,
    pub pAttachments: *const ImageView,
    pub width: u32,
    pub height: u32,
    pub layers: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AttachmentDescription {
    pub flags: AttachmentDescriptionFlags,
    pub format: Format,
    pub samples: SampleCountFlags,
    pub loadOp: AttachmentLoadOp,
    pub storeOp: AttachmentStoreOp,
    pub stencilLoadOp: AttachmentLoadOp,
    pub stencilStoreOp: AttachmentStoreOp,
    pub initialLayout: ImageLayout,
    pub finalLayout: ImageLayout,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AttachmentReference {
    pub attachment: u32,
    pub layout: ImageLayout,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SubpassDescription {
    pub flags: SubpassDescriptionFlags,
    pub pipelineBindPoint: PipelineBindPoint,
    pub inputAttachmentCount: u32,
    pub pInputAttachments: *const AttachmentReference,
    pub colorAttachmentCount: u32,
    pub pColorAttachments: *const AttachmentReference,
    pub pResolveAttachments: *const AttachmentReference,
    pub pDepthStencilAttachment: *const AttachmentReference,
    pub preserveAttachmentCount: u32,
    pub pPreserveAttachments: *const u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct SubpassDependency {
    pub srcSubpass: u32,
    pub dstSubpass: u32,
    pub srcStageMask: PipelineStageFlags,
    pub dstStageMask: PipelineStageFlags,
    pub srcAccessMask: AccessFlags,
    pub dstAccessMask: AccessFlags,
    pub dependencyFlags: DependencyFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct RenderPassCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: RenderPassCreateFlags,
    pub attachmentCount: u32,
    pub pAttachments: *const AttachmentDescription,
    pub subpassCount: u32,
    pub pSubpasses: *const SubpassDescription,
    pub dependencyCount: u32,
    pub pDependencies: *const SubpassDependency,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CommandPoolCreateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: CommandPoolCreateFlags,
    pub queueFamilyIndex: u32,
}
#[repr(C)]
pub struct CommandBufferAllocateInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub commandPool: CommandPool,
    pub level: CommandBufferLevel,
    pub commandBufferCount: u32,
}
#[repr(C)]
pub struct CommandBufferInheritanceInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub renderPass: RenderPass,
    pub subpass: u32,
    pub framebuffer: Framebuffer,
    pub occlusionQueryEnable: Bool32,
    pub queryFlags: QueryControlFlags,
    pub pipelineStatistics: QueryPipelineStatisticFlags,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct CommandBufferBeginInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub flags: CommandBufferUsageFlags,
    pub pInheritanceInfo: *const CommandBufferInheritanceInfo,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BufferCopy {
    pub srcOffset: DeviceSize,
    pub dstOffset: DeviceSize,
    pub size: DeviceSize,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageSubresourceLayers {
    pub aspectMask: ImageAspectFlags,
    pub mipLevel: u32,
    pub baseArrayLayer: u32,
    pub layerCount: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageCopy {
    pub srcSubresource: ImageSubresourceLayers,
    pub srcOffset: Offset3D,
    pub dstSubresource: ImageSubresourceLayers,
    pub dstOffset: Offset3D,
    pub extent: Extent3D,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageBlit {
    pub srcSubresource: ImageSubresourceLayers,
    pub srcOffsets: [Offset3D; 2usize],
    pub dstSubresource: ImageSubresourceLayers,
    pub dstOffsets: [Offset3D; 2usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BufferImageCopy {
    pub bufferOffset: DeviceSize,
    pub bufferRowLength: u32,
    pub bufferImageHeight: u32,
    pub imageSubresource: ImageSubresourceLayers,
    pub imageOffset: Offset3D,
    pub imageExtent: Extent3D,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ClearDepthStencilValue {
    pub depth: ::std::os::raw::c_float,
    pub stencil: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ClearAttachment {
    pub aspectMask: ImageAspectFlags,
    pub colorAttachment: u32,
    pub clearValue: ClearValue,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ClearRect {
    pub rect: Rect2D,
    pub baseArrayLayer: u32,
    pub layerCount: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Default)]
pub struct ImageResolve {
    pub srcSubresource: ImageSubresourceLayers,
    pub srcOffset: Offset3D,
    pub dstSubresource: ImageSubresourceLayers,
    pub dstOffset: Offset3D,
    pub extent: Extent3D,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MemoryBarrier {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub srcAccessMask: AccessFlags,
    pub dstAccessMask: AccessFlags,
}
#[repr(C)]
pub struct BufferMemoryBarrier {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub srcAccessMask: AccessFlags,
    pub dstAccessMask: AccessFlags,
    pub srcQueueFamilyIndex: u32,
    pub dstQueueFamilyIndex: u32,
    pub buffer: Buffer,
    pub offset: DeviceSize,
    pub size: DeviceSize,
}
#[repr(C)]
pub struct ImageMemoryBarrier {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub srcAccessMask: AccessFlags,
    pub dstAccessMask: AccessFlags,
    pub oldLayout: ImageLayout,
    pub newLayout: ImageLayout,
    pub srcQueueFamilyIndex: u32,
    pub dstQueueFamilyIndex: u32,
    pub image: Image,
    pub subresourceRange: ImageSubresourceRange,
}
#[repr(C)]
pub struct RenderPassBeginInfo {
    pub sType: StructureType,
    pub pNext: *const ::std::os::raw::c_void,
    pub renderPass: RenderPass,
    pub framebuffer: Framebuffer,
    pub renderArea: Rect2D,
    pub clearValueCount: u32,
    pub pClearValues: *const ClearValue,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DispatchIndirectCommand {
    pub x: u32,
    pub y: u32,
    pub z: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DrawIndexedIndirectCommand {
    pub indexCount: u32,
    pub instanceCount: u32,
    pub firstIndex: u32,
    pub vertexOffset: i32,
    pub firstInstance: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct DrawIndirectCommand {
    pub vertexCount: u32,
    pub instanceCount: u32,
    pub firstVertex: u32,
    pub firstInstance: u32,
}


text:
.reflex-element {
  overflow: hidden !important;
}

.monaco-menu .action-label {
  color: var(--highlight-color);
  letter-spacing: 0.02em;
}

.monaco-aria-container {
  top: -999em;
}

#challenge-page-tabs .nav-tabs {
  margin-left: 2px;
  display: flex;
}

#challenge-page-tabs .nav-tabs > li {
  flex: 1;
  text-align: center;
}

#challenge-page-tabs .nav-tabs > li > a {
  padding: 5px 10px;
  text-decoration: none;
  font-size: 0.8em;
}

#challenge-page-tabs .nav-tabs > li > a:hover {
  color: var(--gray-85);
}

#challenge-page-tabs .tab-content {
  height: calc(
    100vh - var(--header-height, 0px) - var(--flash-message-height, 0px) - 69px
  );
  overflow-y: auto;
}

#challenge-page-tabs .tab-pane {
  height: 100%;
  overflow: hidden;
}

#challenge-page-tabs .nav-tabs > li.active > a {
  color: var(--quaternary-color);
  background-color: var(--quaternary-background);
}

.monaco-editor .editor-widget {
  display: none !important;
}

.monaco-menu .monaco-action-bar.vertical .action-item:nth-last-child(n + 5),
.monaco-menu .monaco-action-bar.vertical .action-item:last-child,
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
  display: none !important;
}


text:
package Schule.Vererbung;

public class Pkw extends Fahrzeug{
	private String fahrzeugtyp = "Pkw";
	private String modellBezeichnung;

	public Pkw() {
		modellBezeichnung = EnterProperties("Please enter the model description: ");
	}

	public void print() {
		System.out.println("Hersteller: " + herstellerName + ", Preis: " + preis + ", Fahrzeugtyp: " + fahrzeugtyp + ", Modellbezeichnung: " + modellBezeichnung);
	}
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ChangeSignature;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Notification;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Text.Classification;
using Roslyn.Utilities;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature
{
    internal partial class ChangeSignatureDialogViewModel : AbstractNotifyPropertyChanged
    {
        private readonly IClassificationFormatMap _classificationFormatMap;
        private readonly ClassificationTypeMap _classificationTypeMap;
        private readonly INotificationService _notificationService;
        private readonly ParameterConfiguration _originalParameterConfiguration;

        // This can be changed to ParameterViewModel if we will allow adding 'this' parameter.
        private readonly ExistingParameterViewModel? _thisParameter;
        private readonly List<ParameterViewModel> _parametersWithoutDefaultValues;
        private readonly List<ParameterViewModel> _parametersWithDefaultValues;

        // This can be changed to ParameterViewModel if we will allow adding 'params' parameter.
        private readonly ExistingParameterViewModel? _paramsParameter;
        private readonly HashSet<ParameterViewModel> _disabledParameters = new();

        private ImmutableArray<SymbolDisplayPart> _declarationParts;
        private bool _previewChanges;

        /// <summary>
        /// The document where the symbol we are changing signature is defined.
        /// </summary>
        private readonly Document _document;
        private readonly int _positionForTypeBinding;

        internal ChangeSignatureDialogViewModel(
            ParameterConfiguration parameters,
            ISymbol symbol,
            Document document,
            int positionForTypeBinding,
            IClassificationFormatMap classificationFormatMap,
            ClassificationTypeMap classificationTypeMap)
        {
            _originalParameterConfiguration = parameters;
            _document = document;
            _positionForTypeBinding = positionForTypeBinding;
            _classificationFormatMap = classificationFormatMap;
            _classificationTypeMap = classificationTypeMap;

            _notificationService = document.Project.Solution.Workspace.Services.GetRequiredService<INotificationService>();

            // This index is displayed to users. That is why we start it from 1.
            var initialDisplayIndex = 1;

            if (parameters.ThisParameter != null)
            {
                _thisParameter = new ExistingParameterViewModel(this, parameters.ThisParameter, initialDisplayIndex++);
                _disabledParameters.Add(_thisParameter);
            }

            _declarationParts = symbol.ToDisplayParts(s_symbolDeclarationDisplayFormat);

            _parametersWithoutDefaultValues = CreateParameterViewModels(parameters.ParametersWithoutDefaultValues, ref initialDisplayIndex);
            _parametersWithDefaultValues = CreateParameterViewModels(parameters.RemainingEditableParameters, ref initialDisplayIndex);

            if (parameters.ParamsParameter != null)
            {
                _paramsParameter = new ExistingParameterViewModel(this, parameters.ParamsParameter, initialDisplayIndex++);
            }

            UpdateNameConflictMarkers();

            var selectedIndex = parameters.SelectedIndex;
            // Currently, we do not support editing the ThisParameter.
            // Therefore, if there is such parameter, we should move the selectedIndex.
            if (parameters.ThisParameter != null && selectedIndex == 0)
            {
                // If we have at least one parameter after the ThisParameter, select the first one after This.
                // Otherwise, do not select anything.
                if (parameters.ParametersWithoutDefaultValues.Length + parameters.RemainingEditableParameters.Length > 0)
                {
                    this.SelectedIndex = 1;
                }
                else
                {
                    this.SelectedIndex = null;
                }
            }
            else
            {
                this.SelectedIndex = selectedIndex;
            }
        }

        private void UpdateNameConflictMarkers()
        {
            var parameterNameOverlapMap = new Dictionary<string, List<ParameterViewModel>>();
            foreach (var parameter in AllParameters)
            {
                if (!parameter.IsRemoved)
                {
                    parameterNameOverlapMap
                        .GetOrAdd(parameter.ParameterName, _ => new List<ParameterViewModel>())
                        .Add(parameter);
                }
                else
                {
                    parameter.HasParameterNameConflict = Visibility.Collapsed;
                }
            }

            foreach (var parameterName in parameterNameOverlapMap.Keys)
            {
                var matchingParameters = parameterNameOverlapMap[parameterName];
                if (matchingParameters.Count > 1)
                {
                    foreach (var matchingParameter in matchingParameters)
                    {
                        matchingParameter.HasParameterNameConflict = Visibility.Visible;
                    }
                }
                else
                {
                    matchingParameters.Single().HasParameterNameConflict = Visibility.Collapsed;
                }
            }

            NotifyPropertyChanged(nameof(AllParameters));
        }

        public AddParameterDialogViewModel CreateAddParameterDialogViewModel()
            => new(_document, _positionForTypeBinding);

        private List<ParameterViewModel> CreateParameterViewModels(ImmutableArray<Parameter> parameters, ref int initialIndex)
        {
            var list = new List<ParameterViewModel>();
            foreach (ExistingParameter existingParameter in parameters)
            {
                list.Add(new ExistingParameterViewModel(this, existingParameter, initialIndex));
                initialIndex++;
            }

            return list;
        }

        public int GetStartingSelectionIndex()
        {
            if (_thisParameter == null)
            {
                return 0;
            }

            if (_parametersWithDefaultValues.Count + _parametersWithoutDefaultValues.Count > 0)
            {
                return 1;
            }

            return -1;
        }

        public bool PreviewChanges
        {
            get
            {
                return _previewChanges;
            }

            set
            {
                _previewChanges = value;
            }
        }

        public bool CanRemove
        {
            get
            {
                if (!EditableParameterSelected(out var index))
                {
                    return false;
                }

                return !AllParameters[index].IsRemoved;
            }
        }

        public bool CanRestore
        {
            get
            {
                if (!EditableParameterSelected(out var index))
                {
                    return false;
                }

                return AllParameters[index].IsRemoved;
            }
        }

        private bool EditableParameterSelected(out int index)
        {
            index = -1;

            if (!AllParameters.Any())
            {
                return false;
            }

            if (!SelectedIndex.HasValue)
            {
                return false;
            }

            index = SelectedIndex.Value;

            if (index == 0 && _thisParameter != null)
            {
                return false;
            }

            return true;
        }

        internal void Remove()
        {
            if (AllParameters[_selectedIndex!.Value] is AddedParameterViewModel)
            {
                var parameterToRemove = AllParameters[_selectedIndex!.Value];

                if (_parametersWithoutDefaultValues.Contains(parameterToRemove))
                {
                    _parametersWithoutDefaultValues.Remove(parameterToRemove);
                }
                else
                {
                    _parametersWithDefaultValues.Remove(parameterToRemove);
                }
            }
            else
            {
                AllParameters[_selectedIndex!.Value].IsRemoved = true;
            }

            UpdateNameConflictMarkers();
            RemoveRestoreNotifyPropertyChanged();
        }

        internal void Restore()
        {
            AllParameters[_selectedIndex!.Value].IsRemoved = false;
            UpdateNameConflictMarkers();
            RemoveRestoreNotifyPropertyChanged();
        }

        internal void AddParameter(AddedParameter addedParameter)
        {
            if (addedParameter.IsRequired)
            {
                _parametersWithoutDefaultValues.Add(new AddedParameterViewModel(this, addedParameter));
            }
            else
            {
                _parametersWithDefaultValues.Add(new AddedParameterViewModel(this, addedParameter));
            }

            UpdateNameConflictMarkers();
            RemoveRestoreNotifyPropertyChanged();
        }

        internal void RemoveRestoreNotifyPropertyChanged()
        {
            NotifyPropertyChanged(nameof(AllParameters));
            NotifyPropertyChanged(nameof(SignatureDisplay));
            NotifyPropertyChanged(nameof(SignaturePreviewAutomationText));
            NotifyPropertyChanged(nameof(CanRemove));
            NotifyPropertyChanged(nameof(RemoveAutomationText));
            NotifyPropertyChanged(nameof(CanRestore));
            NotifyPropertyChanged(nameof(RestoreAutomationText));
        }

        internal ParameterConfiguration GetParameterConfiguration()
        {
            return new ParameterConfiguration(
                _originalParameterConfiguration.ThisParameter,
                _parametersWithoutDefaultValues.Where(p => !p.IsRemoved).Select(p => p.Parameter).ToImmutableArray(),
                _parametersWithDefaultValues.Where(p => !p.IsRemoved).Select(p => p.Parameter).ToImmutableArray(),
                (_paramsParameter == null || _paramsParameter.IsRemoved) ? null : (ExistingParameter)_paramsParameter.Parameter,
                selectedIndex: -1);
        }

        private static readonly SymbolDisplayFormat s_symbolDeclarationDisplayFormat = new(
            genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
            miscellaneousOptions:
                SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
                SymbolDisplayMiscellaneousOptions.UseSpecialTypes |
                SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier,
            extensionMethodStyle: SymbolDisplayExtensionMethodStyle.StaticMethod,
            memberOptions:
                SymbolDisplayMemberOptions.IncludeType |
                SymbolDisplayMemberOptions.IncludeExplicitInterface |
                SymbolDisplayMemberOptions.IncludeAccessibility |
                SymbolDisplayMemberOptions.IncludeModifiers |
                SymbolDisplayMemberOptions.IncludeRef);

        private static readonly SymbolDisplayFormat s_parameterDisplayFormat = new(
            genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
            miscellaneousOptions:
                SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
                SymbolDisplayMiscellaneousOptions.UseSpecialTypes |
                SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier,
            parameterOptions:
                SymbolDisplayParameterOptions.IncludeType |
                SymbolDisplayParameterOptions.IncludeParamsRefOut |
                SymbolDisplayParameterOptions.IncludeDefaultValue |
                SymbolDisplayParameterOptions.IncludeExtensionThis |
                SymbolDisplayParameterOptions.IncludeName);

        public TextBlock SignatureDisplay
        {
            get
            {
                // TODO: Should probably use original syntax & formatting exactly instead of regenerating here
                var displayParts = GetSignatureDisplayParts();

                var textBlock = displayParts.ToTaggedText().ToTextBlock(_classificationFormatMap, _classificationTypeMap);

                foreach (var inline in textBlock.Inlines)
                {
                    inline.FontSize = 12;
                }

                textBlock.IsEnabled = false;
                return textBlock;
            }
        }

        public string SignaturePreviewAutomationText
        {
            get
            {
                return GetSignatureDisplayParts().Select(sdp => sdp.ToString()).Join(" ");
            }
        }

        internal string TEST_GetSignatureDisplayText()
            => GetSignatureDisplayParts().Select(p => p.ToString()).Join("");

        private List<SymbolDisplayPart> GetSignatureDisplayParts()
        {
            var displayParts = new List<SymbolDisplayPart>();

            displayParts.AddRange(_declarationParts);
            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, "("));

            var first = true;
            foreach (var parameter in AllParameters.Where(p => !p.IsRemoved))
            {
                if (!first)
                {
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ","));
                    displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Space, null, " "));
                }

                first = false;

                switch (parameter)
                {
                    case ExistingParameterViewModel existingParameter:
                        displayParts.AddRange(existingParameter.ParameterSymbol.ToDisplayParts(s_parameterDisplayFormat));
                        break;

                    case AddedParameterViewModel addedParameterViewModel:
                        var languageService = _document.GetRequiredLanguageService<IChangeSignatureViewModelFactoryService>();
                        displayParts.AddRange(languageService.GeneratePreviewDisplayParts(addedParameterViewModel));
                        break;

                    default:
                        throw ExceptionUtilities.UnexpectedValue(parameter.GetType().ToString());
                }
            }

            displayParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, null, ")"));
            return displayParts;
        }

        public List<ParameterViewModel> AllParameters
        {
            get
            {
                var list = new List<ParameterViewModel>();
                if (_thisParameter != null)
                {
                    list.Add(_thisParameter);
                }

                list.AddRange(_parametersWithoutDefaultValues);
                list.AddRange(_parametersWithDefaultValues);

                if (_paramsParameter != null)
                {
                    list.Add(_paramsParameter);
                }

                return list;
            }
        }

        public bool CanMoveUp
        {
            get
            {
                if (!SelectedIndex.HasValue)
                {
                    return false;
                }

                var index = SelectedIndex.Value;
                index = _thisParameter == null ? index : index - 1;
                if (index <= 0 || index == _parametersWithoutDefaultValues.Count || index >= _parametersWithoutDefaultValues.Count + _parametersWithDefaultValues.Count)
                {
                    return false;
                }

                return true;
            }
        }

        public bool CanMoveDown
        {
            get
            {
                if (!SelectedIndex.HasValue)
                {
                    return false;
                }

                var index = SelectedIndex.Value;
                index = _thisParameter == null ? index : index - 1;
                if (index < 0 || index == _parametersWithoutDefaultValues.Count - 1 || index >= _parametersWithoutDefaultValues.Count + _parametersWithDefaultValues.Count - 1)
                {
                    return false;
                }

                return true;
            }
        }

        internal void MoveUp()
        {
            Debug.Assert(CanMoveUp);

            var index = SelectedIndex!.Value;
            index = _thisParameter == null ? index : index - 1;
            Move(index < _parametersWithoutDefaultValues.Count ? _parametersWithoutDefaultValues : _parametersWithDefaultValues, index < _parametersWithoutDefaultValues.Count ? index : index - _parametersWithoutDefaultValues.Count, delta: -1);
        }

        internal void MoveDown()
        {
            Debug.Assert(CanMoveDown);

            var index = SelectedIndex!.Value;
            index = _thisParameter == null ? index : index - 1;
            Move(index < _parametersWithoutDefaultValues.Count ? _parametersWithoutDefaultValues : _parametersWithDefaultValues, index < _parametersWithoutDefaultValues.Count ? index : index - _parametersWithoutDefaultValues.Count, delta: 1);
        }

        private void Move(List<ParameterViewModel> list, int index, int delta)
        {
            var param = list[index];
            list.RemoveAt(index);
            list.Insert(index + delta, param);

            SelectedIndex += delta;

            NotifyPropertyChanged(nameof(AllParameters));
            NotifyPropertyChanged(nameof(SignatureDisplay));
            NotifyPropertyChanged(nameof(SignaturePreviewAutomationText));
        }

        internal bool CanSubmit([NotNullWhen(false)] out string? message)
        {
            var canSubmit = AllParameters.Any(p => p.IsRemoved) ||
                AllParameters.Any(p => p is AddedParameterViewModel) ||
                    !_parametersWithoutDefaultValues.OfType<ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.ParametersWithoutDefaultValues.Cast<ExistingParameter>().Select(p => p.Symbol)) ||
                    !_parametersWithDefaultValues.OfType<ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.RemainingEditableParameters.Cast<ExistingParameter>().Select(p => p.Symbol));

            if (!canSubmit)
            {
                message = ServicesVSResources.You_must_change_the_signature;
                return false;
            }

            message = null;
            return true;
        }

        internal bool TrySubmit()
        {
            if (!CanSubmit(out var message))
            {
                _notificationService.SendNotification(message, severity: NotificationSeverity.Information);
                return false;
            }

            return true;
        }

        private bool IsDisabled(ParameterViewModel parameterViewModel)
        {
            return _disabledParameters.Contains(parameterViewModel);
        }

        private int? _selectedIndex;
        public int? SelectedIndex
        {
            get
            {
                return _selectedIndex;
            }

            set
            {
                var newSelectedIndex = value == -1 ? null : value;
                if (newSelectedIndex == _selectedIndex)
                {
                    return;
                }

                _selectedIndex = newSelectedIndex;

                NotifyPropertyChanged(nameof(CanMoveUp));
                NotifyPropertyChanged(nameof(MoveUpAutomationText));
                NotifyPropertyChanged(nameof(CanMoveDown));
                NotifyPropertyChanged(nameof(MoveDownAutomationText));
                NotifyPropertyChanged(nameof(CanRemove));
                NotifyPropertyChanged(nameof(RemoveAutomationText));
                NotifyPropertyChanged(nameof(CanRestore));
                NotifyPropertyChanged(nameof(RestoreAutomationText));
            }
        }

        public string MoveUpAutomationText
        {
            get
            {
                if (!CanMoveUp)
                {
                    return string.Empty;
                }

                return string.Format(ServicesVSResources.Move_0_above_1, AllParameters[SelectedIndex!.Value].ShortAutomationText, AllParameters[SelectedIndex!.Value - 1].ShortAutomationText);
            }
        }

        public string MoveDownAutomationText
        {
            get
            {
                if (!CanMoveDown)
                {
                    return string.Empty;
                }

                return string.Format(ServicesVSResources.Move_0_below_1, AllParameters[SelectedIndex!.Value].ShortAutomationText, AllParameters[SelectedIndex!.Value + 1].ShortAutomationText);
            }
        }

        public string RemoveAutomationText
        {
            get
            {
                if (!CanRemove)
                {
                    return string.Empty;
                }

                return string.Format(ServicesVSResources.Remove_0, AllParameters[SelectedIndex!.Value].ShortAutomationText);
            }
        }

        public string RestoreAutomationText
        {
            get
            {
                if (!CanRestore)
                {
                    return string.Empty;
                }

                return string.Format(ServicesVSResources.Restore_0, AllParameters[SelectedIndex!.Value].ShortAutomationText);
            }
        }
    }
}


text:
<?php

namespace Helthe\Component\Turbolinks;

use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
 * Turbolinks implements the server-side logic expected by Turbolinks javascript.
 *
 * @link https://github.com/rails/turbolinks/blob/master/lib/turbolinks.rb
 *
 * @author Carl Alexander <carlalexander@helthe.co>
 */
class Turbolinks
{
    /**
     * Request header used for origin validation.
     *
     * @var string
     */
    const ORIGIN_REQUEST_HEADER = 'X-XHR-Referer';

    /**
     * Response header used for origin validation.
     *
     * @var string
     */
    const ORIGIN_RESPONSE_HEADER = 'Location';

    /**
     * Redirect header inserted in the response.
     *
     * @var string
     */
    const REDIRECT_RESPONSE_HEADER = 'X-XHR-Redirected-To';

    /**
     * Session attribute name for the redirect location.
     *
     * @var string
     */
    const REDIRECT_SESSION_ATTR_NAME = 'helthe_turbolinks_redirect_to';

    /**
     * Cookie attribute name for the request method.
     *
     * @var string
     */
    const REQUEST_METHOD_COOKIE_ATTR_NAME = 'request_method';

    /**
     * Modifies the HTTP headers and status code of the Response so that it can be
     * properly handled by the Turbolinks javascript.
     *
     * @param Request  $request
     * @param Response $response
     */
    public function decorateResponse(Request $request, Response $response)
    {
        $this->addRequestMethodCookie($request, $response);
        $this->modifyStatusCode($request, $response);

        if (!$this->canHandleRedirect($request)) {
            return;
        }

        $session = $request->getSession();

        if ($session->has(self::REDIRECT_SESSION_ATTR_NAME)) {
            $response->headers->add(array(self::REDIRECT_RESPONSE_HEADER => $session->remove(self::REDIRECT_SESSION_ATTR_NAME)));
        }

        if ($response->isRedirect() && $response->headers->has('Location')) {
            $session->set(self::REDIRECT_SESSION_ATTR_NAME, $response->headers->get('Location'));
        }
    }

    /**
     * Adds a cookie with the request method for non-GET requests. If a cookie is present and the request is GET, the
     * cookie is removed to work better with caching solutions. The turbolinks will not initialize if the cookie is set.
     *
     * @param Request  $request
     * @param Response $response
     */
    private function addRequestMethodCookie(Request $request, Response $response)
    {
        if ($request->isMethod('GET') && $request->cookies->has(self::REQUEST_METHOD_COOKIE_ATTR_NAME)) {
            $response->headers->clearCookie(self::REQUEST_METHOD_COOKIE_ATTR_NAME);
        }

        if (!$request->isMethod('GET')) {
            $response->headers->setCookie(new Cookie(self::REQUEST_METHOD_COOKIE_ATTR_NAME, $request->getMethod()));
        }
    }

    /**
     * Checks if the request can handle a Turbolink redirect. You need to have a
     * session and a XHR request header to handle a redirect.
     *
     * @param Request $request
     *
     * @return bool
     */
    private function canHandleRedirect(Request $request)
    {
        $session = $request->getSession();

        return $session instanceof SessionInterface && $request->headers->has(self::ORIGIN_REQUEST_HEADER);
    }

    /**
     * Parse the given url into an origin array with the scheme, host and port.
     *
     * @param string $url
     *
     * @return array
     */
    private function getUrlOrigin($url)
    {
        return array(
            parse_url($url, PHP_URL_SCHEME),
            parse_url($url, PHP_URL_HOST),
            parse_url($url, PHP_URL_PORT),
        );
    }

    /**
     * Checks if the request and the response have the same origin.
     *
     * @param Request  $request
     * @param Response $response
     *
     * @return bool
     */
    private function haveSameOrigin(Request $request, Response $response)
    {
        $requestOrigin = $this->getUrlOrigin($request->headers->get(self::ORIGIN_REQUEST_HEADER));
        $responseOrigin = $this->getUrlOrigin($response->headers->get(self::ORIGIN_RESPONSE_HEADER));

        return $requestOrigin == $responseOrigin;
    }

    /**
     * Modifies the response status code. Checks for cross domain redirects and
     * blocks them.
     *
     * @param Request  $request
     * @param Response $response
     */
    private function modifyStatusCode(Request $request, Response $response)
    {
        if ($request->headers->has(self::ORIGIN_REQUEST_HEADER)
            && $response->headers->has(self::ORIGIN_RESPONSE_HEADER)
            && !$this->haveSameOrigin($request, $response)
        ) {
            $response->setStatusCode(Response::HTTP_FORBIDDEN);
        }
    }
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="bc.css">

DirectShape Topics and Happy New Year!

Happy New Year!

I had a great break over Christmas and New Year and hope you did as well.

I'll begin the new year by discussing a bunch of topics addressing various aspects of DirectShape elements:

Updated DirectShapeFromFace

Improve loft form creation speed using DirectShape

Create DirectShape instead of conceptual mass

Create surface from face

Create DirectShape from solid

Control DirectShape colour and material

Improve family performance suppressing DirectShape generation

Create DirectShape from room

Updated DirectShapeFromFace

One useful little DirectShape utility is

the DirectShapeFromFace add-in.

It  creates a DirectShape element from a selected element face.

We initially discussed it in 2015, in the article
on DirectShape From Face and Sketch Plane Reuse.

It demonstrates several approaches, including
a simpler access to the picked face using GetTotalTransform.

Now I migrated it from Revit 2016 to Revit 2018, replacing a couple of obsolete API calls.

Improve Loft Form Creation Speed using DirectShape

One of the most important features of direct shapes is the ability to generate geometry directly in place in the model without needing to create a separate family definition and instantiate that, resulting in a  vast speed improvement.

For example, a developer was creating a new mass family and loading it in the project, taking so much time to create a loft form that it ended up unusable.

The form was generated in a standard way to create families, using Document.FamilyCreate.NewLoftForm with a ReferenceArray of CurveByPoint or ModelCurve elements.

It takes about 4 minutes to create a family in this manner.

Question: Is there any work-around to create a loft form faster?

Answer: Depending on the kind of geometry you want to create, you might be able to use a DirectShape element instead:

DirectShape performance and minimum size

DirectShape versus families, category and texture

From Hack to App – OBJ Mesh Import to DirectShape

Create DirectShape Instead of Conceptual Mass

I the same vein,
the Revit API discussion forum thread
on creating a surface through Revit API suggests
using a DirectShape instead of a conceptual mass element and also introduces
the new topic group #5.50 dedicated to
the DirectShape element.

Create Surface from Face

Another discussion also deals with creating a surface from a picked element face:

Question: I'm working on a function that creates surfaces from selected faces.
It really does not matter what type of element the resulting surface is as long as it gets exported to Navisworks.

What I have been able to do is to collect the faces with the PickObjects method.
I have also succeeded creating a mass family representing a surface.
This I have achieved by collecting the edges of the face and then I have created the surface object by using NewFormByCap.

But this approach does not work on all faces, especially if one of the edges is a HermiteSpline.
I have tried to create a mesh out of the face and then create a tiny surface of each of the triangles using the NewFormByCap method. This do sort of works, but it takes way too long – hours for just a single face.

Do you have any idea how I can solve this issue? It does not have to be a surface; it can also be a very thin solid.
The function should work on all possible faces in Revit. Any help is appreciated.

Answer: Surprisingly, yes, I do have a viable suggestion for you.

It is even significantly easier and simpler and more efficient than what you have been trying so far, and I think it can work for all surfaces.

In Revit 2015, the DirectShape element was introduced as a possibility to generate faceted geometry directly in the project space.

All previous methods to define custom geometry required a family definition, like the method you describe.

Here is my simple suggestion:

Grab the surface that you are interested in and tessellate it. You now have a bunch of triangles.

Create a DirectShape based on these triangles.

This discussion ultimately gave rise to the DirectShapeFromFace project discussed above.

Create DirectShape from Solid

Another question on creating direct shapes was raised in
the Revit API discussion forum thread
on whether Hermite and Nurb Spline need to be created on a plane.
It also compares NewLoftForm with DirectShape, and then ends up asking:

Question: You state that you can "... create a DirectShape element using the 'solid' geometry created above." Where can I find code which shows how to do that?

Answer: You just have to package the solid in a GeometryObject array, then DirectShape.CreateElement works, as described in
the knowledge base article on DirectShape.

Control DirectShape Colour and Material

Let's round off with some aspects of controlling DirectShape colour and material, e.g.,
the Revit API discussion forum thread
on using API to change color and/or material of DirectShape:

Question: When importing my IFC file, all elements get converted to DirectShape elements.

But they now get colored fully black when viewing in shaded mode, and there seems to be no way to change this.

Only workaround is to overwrite graphics per view, but I would rather work to a more solid solution.

Is there some way to change the color of the DirectShape elements? From what I understood, a material could not be applied to a DirectShape.

When I import more IFC's from the same source with different export settings, it seems I sometimes get different color results.

So, I can conclude that the color is stored somewhere within these DirectShape elements. I still cannot find where, and whether it can be changed though API.

Answer: The best way to control the colour of a direct shape element is probably by setting an appropriate category or subcategory on it.

As you presumably know, there
are many ways to control the material and colour of a Revit element

If you prefer setting the colour explicitly, you can look at

Change element colour

How to change the colour of an element

Here is some code for that using OverrideGraphicSettings
to change the colour of an extrusion object:

  Color color = new Color( 0, 0, 0 ); // RGB (0, 255, 255)
  OverrideGraphicSettings ogs = new OverrideGraphicSettings();
  ogs.SetProjectionLineColor( color );
  ogs.SetProjectionFillColor( color );
  ogs.SetCutFillColor( color );
  ogs.SetCutLineColor( color );
  doc.ActiveView.SetElementOverrides( fiProfile.Id, ogs );

However, controlling the material and colour via the direct shape category is much more BIMish!

If your IFC DirectShapes do not provide Material parameters you can set, and if you cannot change their categories, then you could try to:

Read their geometry

Create new DirectShape elements using this geometry

Delete the original IFC DirectShape elements

The advantage is that you have more control over the DirectShape properties at creation time.

Improve Family Performance Suppressing DirectShape Generation

Question: I use DirectShape to accelerate creating shapes in my family definition.

It includes so many shapes now that Revit exhibits slow performance.

Can I improve this?

Is it possible to temporarily suppress the representation and drawing of DirectShape regeneration?

Answer: Drawing of elements can be suppressed by hiding the associated category in the view, however it is unlikely that the impact of excessive element creation will be limited to creation. Having too many elements in a family will slow down family load and update times. Further I expect that performance problems may be encountered in the project environment as well. There is likely a better, more scalable solution to the problem they are trying to solve that doesn't involve creation of too many elements.

When you add an element to a family definition, you can always specify its visibility using
the FamilyElementVisibility class.

This includes both view direction and level of detail:

Fine / medium / coarse

2D front / top / back

3D

This applies to all geometry in a family definition.

Therefore, you can simply define the visibility for all complex direct shapes to be visible only in 3D views and only in fine level of detail.

I would expect that to solve the issue effectively.

Please note that unlike other elements, it is not yet possible to associate DirectShape elements in family definitions with visibility controls.
It should apply to all geometric elements, but the operation is actually element based, and has not been enabled for DirectShapes yet.
There doesn't seem to be a Revit Ideas item filed for this functionality, although the team is already aware of the gap.

Happily, this can be worked around making use of the fact that visibility can be set for a family instance nested in the family definition document and creating a FamilyInstance containing the DirectShape inside the family document.

Create DirectShape from Room

Finally, to round off this collectio0n of DirectShape topics, yet
another Revit API discussion forum thread
on creating direct shape from room and
using the spatial geometry calculator versus room boundary to achieve that:

Question: How can I create DirectShape from rooms with holes?

I read many discussion and post but I wasn't able to solve the problem!

More info and source in this GitHub issue:

GitHub issue

Revit3Drooms source code

Last reading:

2D polygon areas and outer loop

Create mass from room

Many thanks for help!

Answer: If you want the room with holes, then there will be nothing left.

The room is a hole.

What else is a room except a hole?

Do you mean that you would like to recreate the shape of all the walls with their openings?

Do you mean that you have a room whose plan view includes holes?

Let's assume the latter.

In that case, if your walls are all vertical, this is absolutely trivial.

You can collect the room boundary edges and assemble them into the outer and inner wall loops.

This is demonstrated very effectively by
the 2D room editor,
which retrieves this information, converts it to a simplified 2D view in SVG, and displays the room outline in a web browser:

Here is a demo recording and lots of other supporting material.

If you want a 3D direct shape instead of a 2D flat version, you will obviously need to determine the ceiling height and location and take that into account as well.

Update:

OK, I now went and read your problem description.

:-)

Very clear. Thank you for that.

Thank you also for your appreciation!

That issue is indeed addressed by
the RoomEditorApp that
I already pointed to.

When you retrieve the room boundary, the edges may not be contiguous in the right order.

You may need to order them yourself.

There are several ways of achieving that:

DIY. I love do it yourself. Search for SortCurvesContiguous.

ExporterIFCUtils.ValidateCurveLoops. Maybe. The Edge.AsCurveFollowingFace method. Maybe. But read on through the following, and note the note in the last of the discussions listed below.

For the former, here is some more reading material:

2D Polygon Areas and Outer Loop

Curve Following Face and Bounding Box Implementation

Retrieving Plan View Room Boundary Polygon Loops

Extrusion Analyser and Plan View Boundaries

Room and Furniture Loops Using Symbols

ContiguousCurveSorter

Sorting Face Loop Edges

I have explored and written lots more on this topic, as you can see if you follow the various links in the discussions listed above.

I am confident that this will give you all you need.

I see that what you are after is basically the floor slabs under the rooms.

I assume that you are not interested in querying the slabs for their geometry?

You want to create these shapes from the room boundaries?

Well, I think you have all you need now for that.

Response: You ask:

"Do you mean that you have a room whose plan view includes holes?"

Yes, I would like to create the volume of the room. If the room has holes (Because walls), I would also like to subtract the volume of the hole.

In short, I feel ... that you translated perfectly my strange English !

"You want to create these shapes from the room boundaries?"

Yes, exactly. For the elevation, I need only a fixed height (very simple).

Update – here is the solution:

It was necessary to add a call in the boundary loop: curveLoopList.Add(curveLoop);

  foreach( IList<BoundarySegment> b in boundaries )
  {
    List<Curve> profile = new List<Curve>();
    ++iBoundary;
    iSegment = 0;

    foreach( BoundarySegment s in b )
    {
      ++iSegment;
      Curve curve = s.GetCurve();

      profile.Add( curve );
    }

    try
    {
      CurveLoop curveLoop = CurveLoop.Create( profile );
      curveLoopList.Add( curveLoop );
    }
    catch( Exception ex )
    {
      Debug.WriteLine( ex.Message );
    }
  }

Full code/demo in
the Revit3Drooms GitHub repository.

Answer: Maybe I'm missing something here, but why can't you use the SpatialElementGeometryCalculator?

That gives you the solid you require for the DirectShape immediately; I've used this for quite a few implementations.

Does this not take holes into account?

Response: The SpatialElementGeometryCalculator works for rooms?

For a general case this works well but I did not succeed for rooms. Have you already tried ?

Answer: I haven't read through all your material, so I'm not sure about if your specific case needs something special, but it can extract solid geometry and I haven't seen any drawbacks.

The Room type directly inherits SpatialElement, so yes, it sure works.

Here is a sample from the documentation:

  // Calculate a room's geometry and find its boundary faces

  SpatialElementGeometryCalculator calculator
    = new SpatialElementGeometryCalculator( doc );

  // Compute the room geometry

  SpatialElementGeometryResults results
    = calculator.CalculateSpatialElementGeometry( room );

  // Get the solid representing the room geometry

  Solid roomSolid = results.GetGeometry();

  foreach( Face face in roomSolid.Faces )
  {
    double faceArea = face.Area;

    // Get the sub-faces for the face of the room

    IList<SpatialElementBoundarySubface> subfaceList
      = results.GetBoundaryFaceInfo( face );

    foreach( SpatialElementBoundarySubface subface in subfaceList )
    {
      // There are multiple sub-faces that define the face

      if( subfaceList.Count > 1 )
      {
        double subfaceArea = subface.GetSubface().Area;
        // get the area of each sub-face
        // sub-faces exist in situations such as
        // when a room-bounding wall has been
        // horizontally split and the faces of each
        // split wall combine to create the
        // entire face of the room
      }
    }
  }

Response: Thank you very much! That seems really good!

The only special thing: I must have a cut to 1 ft from the floor.

Answer: The BooleanOperationsUtils class gives you some options where I think the CutWithHalfSpace seems like the most useful one.

However, I mean, if your code works, then go for it. I was just hinting at a more easy solution for future use.

OK, that is more than enough on direct shapes for now, isn't it?


text:
require 'spec_helper'

module Sparrowhawk

  describe JRubyCoreJarEntry do
    let(:entry) { JRubyCoreJarEntry.new }

    context '#name' do
      it "should be 'WEB-INF/lib/jruby-core-<jruby-version>.jar'" do
        entry.name.should == "WEB-INF/lib/jruby-core-#{JRubyJars::VERSION}.jar"
      end
    end

    context '#source' do
      it "should exist" do
        File.exists?(entry.source).should be_true
      end
    end
  end
end